Skip to content
Prev 106767 / 398513 Next

Crosstab from sql dump

thanks for all the tips.

using 'unstack(read.table('/tmp/codes', header=TRUE))' gets me

  user1 user2
1   100   100
2   200   200
3   300   300

where /tmp/codes contains

code name
100 user1
200 user1
300 user1
100 user2
200 user2
300 user2

so unstack is exactly what i was looking for. for the record, it is
probably a good idea to specify which column is values and which is
group indicator like 'unstack(read.table('/tmp/crap', header=TRUE),
"code ~ name")' in case your columns are in a different order.

alan
On 12/30/06, Dieter Menne <dieter.menne at menne-biomed.de> wrote: