Re: [R] Help with repeating values in a column of dataframe in R on a random pattern- reg

2010-09-07 Thread jim holtman
I think you want to use replicate: replicate(33, sample(c(0,0,1),3)) On Tue, Sep 7, 2010 at 7:37 AM, Vijayan Padmanabhan wrote: > > Dear Group > I have to populate a column in a R dataframe containing say 99 rows, where > for every 3 row one row (randomly determined) of the column should take >

[R] Help with repeating values in a column of dataframe in R on a random pattern- reg

2010-09-07 Thread Vijayan Padmanabhan
Dear Group I have to populate a column in a R dataframe containing say 99 rows, where for every 3 row one row (randomly determined) of the column should take the value 1 and the other 2 row of that column should take the value 0. I used the command dataframe$new<-rep(sample(c(0,1,0),3,replace=FA