Re: [R] splitting data frame into fixed rows depending on column rep

2015-12-06 Thread Jim Lemon
Hi Ragia, Perhaps the easiest way is to split the data frame into a list by the values of v1: sdf<-split(df,df$v1) Then rename the elements of sdf for convenience: names(sdf)<-paste("v1",1:5,sep="_") Now you can extract whatever you like" sdf$v1_1$v2 [1] 3 4 8 Of course if you only want the v

[R] splitting data frame into fixed rows depending on column rep

2015-12-06 Thread Ragia Ibrahim
Dear group, I have the following data frame             v1 v2  v3 v4 v5 1           1  3 1   3.5    1 2           1  4 3   3.5    1 3           1  8 3   3.5    1 4           2  9 8   2.5    1 5           2 10 9   2.5    1 6           2  6 3   1.5    1 7           3  4 3   2.0    1 8           3