[R] to calculate c(rep("1", 43), rep("2", 43), ...., rep("10", 43))

Rui Barradas ruipbarradas at sapo.pt
Thu Dec 11 11:34:12 CET 2014


Hello,

Try the following.

unlist(lapply(1:10, function(n) rep(as.character(n), 43)))

Hope this helps,

Rui Barradas

Em 11-12-2014 10:12, Arnaud Michel escreveu:
> Hello
> I would like to find an elegant way of calculating
> c(rep("1", 43), rep("2",43),...., rep("10",43))
>
> Any idea ?
> Thank you
>



More information about the R-help mailing list