Re: [R] pivot table help

2011-12-04 Thread set
Thank you very much! works perfectly! -- View this message in context: http://r.789695.n4.nabble.com/pivot-table-help-tp4155144p4156393.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.eth

Re: [R] pivot table help

2011-12-03 Thread jim holtman
Forgot, you can also do this: > dcast(x.m, Cluster ~ value, fun = length) Cluster ind1 ind2 ind3 1 1110 2 2101 3 3110 > On Sat, Dec 3, 2011 at 7:02 PM, jim holtman wrote: > try this: > >> x <- read.table(text = "Cluster   Member1    Member

Re: [R] pivot table help

2011-12-03 Thread jim holtman
try this: > x <- read.table(text = "Cluster Member1Member2 + 1ind1 ind2 + 2ind3 ind1 + 3ind2 ind1", as.is = TRUE, header = TRUE) > require(reshape2) > x.m <- melt(x, id = "Cluster") > x.m Cluster variable value 1 1 Me

Re: [R] pivot table help

2011-12-03 Thread Richard M. Heiberger
Pivot tables are an Excel concept, not an R concept. That means you must give an example of your starting pivot table as an R object (use dump() so we can pick it up from the email and execute it immediately). and an example of the R object you want as the result. Use a trivial but complete exampl

[R] pivot table help

2011-12-03 Thread set
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