Tuesday, November 1, 2011

Generate Factor Levels

> gl(2, 8, labels = c("Control", "Treat"))
[1] Control Control Control Control Control Control Control Control Treat
[10] Treat Treat Treat Treat Treat Treat Treat
Levels: Control Treat
> ?gl
> gl(2, 1, 20)
[1] 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2
Levels: 1 2

No comments: