What do you understand by element recycling in R?

Question

Give an example using datasets

in progress 0
Dhruv2301 4 years 1 Answer 568 views Great Grand Master 0

Answer ( 1 )

  1. If two vectors with different lengths perform an operation –the elements of the shorter vector will be re-used to complete the operation. This is referred to as element recycling.

    Example – Vector A <-c(1,2,0,4) and Vector B<-(3,6) then the result of A*B will be ( 3,12,0,24). Here 3 and 6 of vector B are repeated when computing the result.

Leave an answer

Browse
Browse