[R] calculating mean and s.d. from a two-column table

Jonas Josefsson jonas at runtimerecords.net
Mon Sep 27 18:34:35 CEST 2010


I have a two-column table as follows where age is in the 1st column and 
the number of individuals is in the 2nd.

age;no
1;21
2;31
3;9
4;12
5;6


Can I use mean() and sd() to calculate the mean and standard deviation 
from this or do I have to manually multiplicate 21*1+31*2 etc. / N?



More information about the R-help mailing list