The 2.2 is the number of times that x will be repeated (not what x will be multiplied by). In your example x has length 5 and y has length 11. The 2.2 comes because 2.2 times 5 is 11, so in order to have 2 vectors of the same length to add together, the shorter one (the result of 2*x) which has length 5 has to be repeated (the 2.) then one more element taken from that vector to make the total length 11.
This might be a little more clear if you set y <- rep(0,11)
so that y is still 11 long, but is now 0, so when you do the adding you can see exactly what happens with 2*x
(since adding the vector of 0’s will do the replication, but not change the values).
The phrasing in what you quote is a little awkward in not making a clear distinction between multiplication (2*
) and replication (2.2 times).
1
solved Explanation needed for v <- 2*x + y + 1