[R] split the data

yf chang648 at umn.edu
Thu Feb 24 02:16:14 CET 2011


x<-data.frame(id=c(1,1,2,2,3,3,4,4), v1=c(1:8), V2=c(9:16))
> x
  id v1 V2
1  1  1  9
2  1  2 10
3  2  3 11
4  2  4 12
5  3  5 13
6  3  6 14
7  4  7 15
8  4  8 16

1)

I want to split the data into 2 group with one unique ID. I should use the
split function but i don't know how to write it out.

2)
I tried to random select the one unique case so I have one group.  
  
 id v1 V2

2  1  2 10

4  2  4 12

6  3  6 14
7  4  7 15
How to get the rest of data in other group?

-- 
View this message in context: http://r.789695.n4.nabble.com/split-the-data-tp3321985p3321985.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list