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
>
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
2 matches
Mail list logo