Skip to content
Prev 74776 / 398502 Next

a question about data manipulation

use 'split'
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] 1 1 1 1 1 1 1 1 1 1
 $ 2:`data.frame':      13 obs. of  3 variables:
  ..$ COL1: int [1:13] 1 2 14 16 19 25 26 28 30 31 ...
  ..$ COL2: int [1:13] 50 49 37 35 32 26 25 23 21 20 ...
  ..$ id  : int [1:13] 2 2 2 2 2 2 2 2 2 2 ...
 $ 3:`data.frame':      14 obs. of  3 variables:
  ..$ COL1: int [1:14] 3 8 9 13 17 23 32 36 39 42 ...
  ..$ COL2: int [1:14] 48 43 42 38 34 28 19 15 12 9 ...
  ..$ id  : int [1:14] 3 3 3 3 3 3 3 3 3 3 ...
 $ 4:`data.frame':      13 obs. of  3 variables:
  ..$ COL1: int [1:13] 4 6 7 15 18 20 21 29 35 37 ...
  ..$ COL2: int [1:13] 47 45 44 36 33 31 30 22 16 14 ...
  ..$ id  : int [1:13] 4 4 4 4 4 4 4 4 4 4 ...
[1] "1" "2" "3" "4"
COL1 COL2 id
5     5   46  1
10   10   41  1
11   11   40  1
12   12   39  1
22   22   29  1
24   24   27  1
27   27   24  1
34   34   17  1
38   38   13  1
47   47    4  1
COL1 COL2 id
3     3   48  3
8     8   43  3
9     9   42  3
13   13   38  3
17   17   34  3
23   23   28  3
32   32   19  3
36   36   15  3
39   39   12  3
42   42    9  3
44   44    7  3
45   45    6  3
49   49    2  3
50   50    1  3

        
On 8/2/05, qi zhang <shellyzhang77 at gmail.com> wrote: