Skip to content
Prev 325861 / 398503 Next

extracting submatrix from a bigger one

First of all, thanks for all the replies!!
What you have written helps, but is not entirely the answer to my problem.

What I'd have is the creation of new data.frames each of one named with 
the ID of the original dataframe and with all the columns.

For example, in the original dataframe one column (ID) has 5 different 
elements:

ID    value1    value2
x1        10            12
x1        12            22
x1        11            9
x2        15            10
x3        11            11
x3        13            8

I need a command ables to split the dataframe in other smallest and 
separated dataframes, so that they look like

x1 is
ID    value1    value2
x1        10            12
x1        12            22
x1        11            9

x2 is
ID    value1    value2
x2        15            10

and x3 is
ID    value1    value2
x1        10            12
x3        11            11
x3        13            8


Sorry if I'm not able to explain it better and as I said I'm very new to 
R.....

Thanks

Matteo