Dear R-user,
I have a simple question, I just can't figure out a easy way to handle it.
My importing data x is like this:
COL1 COL2 id
1 12 49 1
2 70 120 1
3 58 124 1
51 14 13 2
52 88 100 2
53 90 134 2
I want to change the format of the data, i want to group data into
differenct part accordin
use 'split'
> x.1 <- data.frame(COL1=1:50, COL2=50:1, id=sample(1:4,50,T))
> x.2 <- split(x.1, x.1$id)
> str(x.2)
List of 4
$ 1:`data.frame': 10 obs. of 3 variables:
..$ COL1: int [1:10] 5 10 11 12 22 24 27 34 38 47
..$ COL2: int [1:10] 46 41 40 39 29 27 24 17 13 4
..$ id : int [1:10