[R] Aggregating a List

Paul Boutros pcboutro at engmail.uwaterloo.ca
Wed Nov 6 20:20:47 CET 2002


Hi all,

There must be a really obvious R solution to this, but I can't figure out
how to aggregate a list.  For instance, if I read.table the following from
a file:
	Val1	Val2
A	3	4
A	5	6
B	4	4

I would like to take the mean (or median) across any/all rows of type "A"
to end up with the structure:

	Val1	Val2
A	4	5
B	4	4

in this case.  How would I go about doign that w/o doing a loop or putting
into a DB and using SQL to do this?

Thanks for any suggestions, or pointers at appropriate functions I should
be reading the documentation on.

Paul

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list