[R-sig-Geo] Data Manipulation

Benno Dillinger benno.dillinger at gmail.com
Sat Dec 8 17:30:25 CET 2012


Dear all,

I'm new to R and I have a question regarding data manipulation:

I have a 2 column dataframe with
ID        value
1        1
1        2
2        3
2        4
3        5
3        6

I would like to create a dataframe that looks like

ID        value1        value2
1        1                    2
2        3                    4
3        5                    6

Any suggestions how to do this?


Additionally, is it possible for the 'numbers' to have different 
lengths, in sense of one ID having 3 entries an still being able to 
perform the (hopefully) suggested operation?

ID        value
1        1
1        2
1        2.5
2        3
2        4
3        5
3        6

==>
ID        value1        value2        value3
1        1                    2               2.5
2        3                    4               NA
3        5                    6               NA

Any help would be appreciated.

Regards

Benno



More information about the R-sig-Geo mailing list