[R] pivot table help

set astareh at hotmail.com
Sat Dec 3 23:27:19 CET 2011


Hello R-users,

I've got a huge table with about 20.00 rows and 50 columns. The table now
has headers as Members1, Members2 etc. My data are 8 different individuals.
And I've got a column with clusters. So each individual belongs to different
clusters and can occurs multiple times within a cluster (that's the reason
that there can be more than 8 members). I want a presence/ absence table for
each individual within each cluster.
So I want to go from:
Cluster   Member1    Member2  etc.
1            ind1           ind2
2            ind3           ind1
3            ind2           ind1

to

cluster    ind1          ind2      ind3
1            1               1          0
2            1                0         1
3            1               1          0

Has anybody any idea how I can do this? I already tried alot of things with
pivottables (using cast()) But I think I'm missing out on something.
thank you

--
View this message in context: http://r.789695.n4.nabble.com/pivot-table-help-tp4155144p4155144.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list