> From: malte
> 
> 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
> 
> Does anyone knows how to do this?

aveBehav <- apply(sdata, 2, mean, na.rm=TRUE)

or more efficiently:

aveBehav <- colMeans(sdata, na.rm=TRUE)

Read ?apply and look at the "..." argument.  If you don't understand how it
works, try the example on that page.

Andy
 
> Thanks in advance,
> 
> Jan
> 
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
> 
>

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to