[R] Apply function to column of array
pcboutro at engmail.uwaterloo.ca
Tue Oct 29 21:32:57 CET 2002
I would like to apply a function to each column of an 2-dimensional array,
and store the result in a new 1-dimensional vector. I am not sure how to
go about doing that syntatically. For instance, can I use lapply? And,
if so, how do I specify which dimension should be used? Also, how do I
pre-specify the type of object that will go into the 1-dimensional vector.
I'm not sure if it is important, the function I wish to apply to the
columns is density(). Additionally, I wish to be able to take these
density objects (stored in that 1-dim vector) and place them onto a
I'm new with R, so I tend to think in loops. I'd appreciate any guidance
or tips on better ways to handle this problem.
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help