[R] how to find the mean and sd :(

Bert Gunter bgunter.4567 at gmail.com
Fri Sep 11 18:17:01 CEST 2015


?tapply

or better yet

?ave ## a wrapper for tapply

allows it to be done without extraction.

Cheers,

Bert


Bert Gunter

"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
   -- Clifford Stoll


On Fri, Sep 11, 2015 at 9:02 AM, Tom Wright <tom at maladmin.com> wrote:
> On Fri, 2015-09-11 at 07:48 -0700, massmatics wrote:
>> AM.warpbreaks<=30
>
> The above command is not returning what you expected, what part of the
> AM.warpbreaks dataframe is expected to be <= 30?
>
> Effectively you are using a two stage process.
> 1) Create a logical vector identifying rows in the dataframe with a
> breaks value <= 30
> 2) use the vector in 1. to extract just the rows you are interested in
> and use that to calculate the mean of the breaks column.
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.



More information about the R-help mailing list