Re: [R] apply

From: Dimitris Rizopoulos <dimitris.rizopoulos_at_med.kuleuven.ac.be>
Date: Thu 07 Apr 2005 - 23:39:28 EST

try,

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

or

# assuming `sdata' is a matrix
colMeans(sdata, na.rm=TRUE)

I hope it helps.

Best,
Dimitris



Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium

Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
     http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm


> 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?
>
> 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 Received on Thu Apr 07 23:43:16 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:03 EST