On Mon, Sep 27, 2010 at 9:34 AM, Jonas Josefsson <jo...@runtimerecords.net> wrote: > 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
You can use the following trick: x = rep(age, no) This repeats age[1] no[1]-times, age[2] no[2]-times, etc... then use the usual mean and sd on x. Peter ______________________________________________ R-help@r-project.org 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.