[R] ave across columns
Hedderik van Rijn
hedderik at cmu.edu
Mon Jan 20 23:47:03 CET 2003
x <- matrix(rnorm(60),20)
x[sample(1:60,10)] <- NA
apply(x,1,mean,na.rm=T)
On Monday, January 20, 2003, at 04:27 PM, Truc Truong wrote:
> Hi:
>
> How do I find average across three columns such as weight1, weight2,
> weight3 (20 people, each person has three different measures)? They
> have NA's also. Thanks
>
> Tom, Univ of Pittsburgh, ttrut at yahoo.com
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
>
--
http://www.van-rijn.org
More information about the R-help
mailing list