[R] Calculating mean together with split

From: Rainer M Krug <rkrug_at_sun.ac.za>
Date: Wed 20 Sep 2006 - 13:52:25 GMT


Hi

I have a table called npl containing results of simulations.

It contains about 19000 entries and the structure looks like this:

  NoPlants                  sim run year DensPlants
1        6 lng_cs99_renosterbos   1    4    0.00192

.
.
.

it has 43 different entries for sim and year goes from 1 to 100, and run from 1 to 5.

I would like to calculate the mean of DensPlants for each simulation and each year seperately, i.e. calculating the mean for all combinations of sim and year over run.

I can use

split(npl, npl$sim)

to split npl into different groups each containing the entries for one parameterset - but where to go from there?

Rainer

-- 
Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation
Biology (UCT)

Department of Conservation Ecology and Entomology
University of Stellenbosch
Matieland 7602
South Africa

Tel:		+27 - (0)72 808 2975 (w)
Fax:		+27 - (0)21 808 3304
Cell:		+27 - (0)83 9479 042

email:	RKrug@sun.ac.za
       	Rainer@krugs.de

______________________________________________
R-help@stat.math.ethz.ch 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 Sep 20 23:50:41 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 20 Sep 2006 - 16:30:18 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.