[R] apply

Sean Davis sdavis2 at mail.nih.gov
Thu Apr 7 15:25:16 CEST 2005


On Apr 7, 2005, at 8:27 AM, malte wrote:

> Hi,
>
> simple question I guess:
>
> the following line works well:
>
> aveBehav=c(apply(sdata, 2, mean))
>
> However, I would like to pass an argument to the function mean, namely 
> na.rm=TRUE
>

apply(sdata,2,function(x) {mean(x,na.rm=TRUE)})

Sean




More information about the R-help mailing list