Displaying 1 result from an estimated 1 matches for "tp20638991p20647978".
2008 Nov 22
5
What's the BEST way in R to adapt this vector?
Goal:
Suppose you have a vector that is a discrete variable with values ranging
from 1 to 3, and length of 10. We'll use this as the example:
y <- c(1,2,3,1,2,3,1,2,3,1)
...and suppose you want your new vector (y.new) to be equal in length to the
possible discrete values (3) times the length (10), and formatted in such a
way that if y[1] == 1, then y.new[1:3] == c(1,0,0), and if y[2] ==