[R] Calculating means in a new table

Dieter Wirz wirzd at gmx.net
Tue Apr 24 14:04:30 CEST 2007


Dear all -
I imported (on a Mac) a big table with >2000 lines:
> mydata <- read.table(file("/Users/didiw/Desktop/R/all.txt"), header = TRUE) 
> mydata[1:15,]
   location Spezies Spec E.MPa.   Phi No Trial  
1        LC       P    J  13.27  7.51  1     1  
2        LC       P    J  14.24  6.68  1     1  
3        LC       P    J  14.28  7.01  2     1  
4        LC       P    J  16.65  6.30  1     2  
....

Now i want to crate a new table "mymeans" where all means and Stdev 
of E.MPa and Phi when location, Spezies, No, and Trial are the same, 
something like this:

   location Spezies Spec No Trial mean.E	stddev.E	mean.Phi	std.Phi
1        LC       P    J 1     1  xx		xx		xx		xx
2        LC       P    J 2     1  xx		xx		xx		xx  
3        LC       P    J 1     2  xx		xx		xx		xx     
....

Because I we did ca 8 repetition of each measurement, the new table should
have only 2000/8 lines.

Thanks for any help!

-didi



More information about the R-help mailing list