[R] Excluding data with apply
Christian Kamenik
christian.kamenik at giub.unibe.ch
Thu Jan 8 11:52:34 CET 2009
Dear all,
'Apply' is a great thing for running functions on rows or columns of a
matrix:
X <- rnorm(20, mean = 0, sd = 1)
dim(X) <- c(5,4)
apply(X,2,sum)
Is there a way to use apply for excluding rows or columns from a matrix
to run functions on the remaining rows or columns? I know, I could do
this with a 'for' loop, but 'apply' would be much easier and quicker,
and require less programming...
Cheers, Christian
More information about the R-help
mailing list