[R] creating list of the from 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, . . ., n, n, n?

Christian Ruckert cruckert at uni-muenster.de
Fri Aug 14 16:56:49 CEST 2009


John Sorkin wrote:
> Windows XP
> R 2.8.1
> 
> Is there any way to make a list of the from
>  1,1,1,2,2,2,3,3,3,4,4,4, . . ., n,n,n?

rep(1:n, each=3)

Greetings,
Christian




More information about the R-help mailing list