Re: [R] new R-user needs help

From: Romain Lorrilliere <romain.lorrilliere_at_ese.u-psud.fr>
Date: Wed 18 Oct 2006 - 09:40:09 GMT

   try this,
   if your data frame name is "tab"
   mean.tab = data.frame (meanA = mean(tab[tab$name == 'a' ,4:8]), meanB

   Romain Lorrillière

   UMR 8079 Laboratoire Ecologie, Systématique et Evolution

   Bât. 362

   Université Paris-Sud

   91405 Orsay cedex

   France

   tel : 01 69 15 56 85

   fax : 01 69 15 56 96

   mobile : 06 81 70 90 70

   email : romain.lorrilliere@ese.u-psud.fr

   [1]antoniababe@yahoo.se a écrit :

Dear all,

I have a dataset

Exp name id x1 x2 x3 x4 x5
1 a 1 23 24 23 22 30
1 b 2 25 26 27 23 24
1 c 3 32 19 23 25 28
2 a 4 28 32 24 26 27
2 b 5 23 24 25 26 28
2 c 6 23 31 30 38 23
3 a 7 24 25 31 27 29
3 b 8 28 25 26 32 28
3 c 9 21 31 28 23 29

where each name a,b and c is repeated three times. Now I want to calculate the the averages of a,b and c over the three experiments for each x. For example for x1 I want to calculate the average of a like

[a(from exp1) + a(exp2)+ a(exp3)]/3= (23+28+24)/3

How can I do that ?

Thanks for your help,
Regards,

Antonia



[2]R-help@stat.math.ethz.ch mailing list
[3]https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide [4]http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

References

  1. mailto:antoniababe@yahoo.se
  2. mailto:R-help@stat.math.ethz.ch
  3. https://stat.ethz.ch/mailman/listinfo/r-help
  4. http://www.R-project.org/posting-guide.html
    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 Oct 18 19:41:24 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 18 Oct 2006 - 10:30:11 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.