Skip to content
Prev 67208 / 398502 Next

apply

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