[R] pivoting - summing up factors

From: juanita choo <juanitachoo_at_gmail.com>
Date: Wed, 07 May 2008 13:56:00 -0500


Hi
I would like to know how to pivot a table that will sum the number of plants (a or b) for each location (x,y,z)
I have read on the listserve similar questions but which involve summing up numbers rather than factors. I have also read about the R package reshape on the listserve but wanted to know if there's a way to do it easily without the package
Thanks for the help!

location plant

 x             a
 x             b
 x             b
 y             b
 y             b
 y             a
 z             a
 z             a

into a table like this

       x            y           z
a     1            1           2
b     2            2           0

	[[alternative HTML version deleted]]

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 07 May 2008 - 19:49:17 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 07 May 2008 - 21:30:40 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive