Repeat elements of vector in R
- by bshor
Hi,
I'm trying to repeat the elements of vector a, b number of times. That is, a="abc" should be "aabbcc" if y = 2.
Why doesn't either of the following code examples work?
sapply(a, function (x) rep(x,b))
and from the plyr package,
aaply(a, function (x) rep(x,b))
I know I'm missing something very obvious ...