[R] tapply function

Sundar Dorai-Raj sdorairaj at gmail.com
Tue Nov 3 14:30:44 CET 2009


you must have missing values in "data". Try

tapply(data, group, mean, na.rm = TRUE)

If that's not the case, read the bottom of this email about the posting guide.

HTH,

--sundar

On Tue, Nov 3, 2009 at 5:28 AM, FMH <kagba2006 at yahoo.com> wrote:
> Hi,
>
> I tried to use tapply function to find the mean of the data in each group as the following command, but the result are NA, as there are several missing values in each group.
>
> tapply(data,group,mean)
>
> Could someone please advice me the way to  ignore the missing data in order for the fucntion to run successfully?
>
> Thanks
>
> Fir
>
>
>
>
> ______________________________________________
> R-help at 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.
>




More information about the R-help mailing list