[R] Vector manipulation

syrvn mentor_ at gmx.net
Sun Feb 12 18:54:16 CET 2012


Hello,


I am stuck with the following problem. Consider the vector:

vec <- c(2,4,6,9,10)

I now want to use R to manipulate the vector as follows:

[1] 2, 4, 2, 6, 2, 9, 2, 10

In words, the first element of the vector should be placed in front of each
following number.

Which R commands do I need to achieve that?


Cheers

--
View this message in context: http://r.789695.n4.nabble.com/Vector-manipulation-tp4381586p4381586.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list