[R] Easier way to do this?

Sarah Goslee sarah.goslee at gmail.com
Tue Jan 31 20:34:27 CET 2012


Which part? This might help:
rep(1:5, each=9)


On Tue, Jan 31, 2012 at 1:22 PM, Daniel Negusse
<daniel.negusse at my.mcphs.edu> wrote:
>  can someone tell me if there is an easier way to do this in R - create a design matrix? thanks.
> —> design <- model.matrix(~ -1+factor(c(1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5))) # Creates an appropriate design matrix
> can someone tell me if there is an easier way to do this matrix?
> thanks.

-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list