| 1. |
What Will Be The Result Of Multiplying Two Vectors In R Having Different Lengths? |
|
Answer» The multiplication of the two vectors will be performed and the output will be displayed with a warning MESSAGE like – “Longer object length is not a multiple of shorter object length.” SUPPOSE there is a VECTOR a<-c (1, 2, 3) and vector b <- (2, 3) then the multiplication of the vectors a*b will give the resultant as 2 6 6 with the warning message. The multiplication is performed in a sequential manner but since the length is not same, the first element of the smaller vector b will be MULTIPLIED with the last element of the larger vector a. The multiplication of the two vectors will be performed and the output will be displayed with a warning message like – “Longer object length is not a multiple of shorter object length.” Suppose there is a vector a<-c (1, 2, 3) and vector b <- (2, 3) then the multiplication of the vectors a*b will give the resultant as 2 6 6 with the warning message. The multiplication is performed in a sequential manner but since the length is not same, the first element of the smaller vector b will be multiplied with the last element of the larger vector a. |
|