Dear R users, I'd like to create a sequence/vector, for example,
1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 4 4 4 4 5 5 5 5 4 4 4 4 5 5 5 5 4 4 4 4 5 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 6 6 6 7 7 7 8 8 8 9 9 9 So I did like this below. a <- 4 b <- 3 c <- 2 grp <- c( rep(1:b, each=c, times=a), rep(1:c, each=a, times=b)+b, rep(1:a, each=b, times=c)+b+c ) I wonder if there is a more elegant way to do this? Any suggestions? Thank you! Best wishes Kathie [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.