[R] apply()
Kaspar Pflugshaupt
pflugshaupt at cirsium.ethz.ch
Fri Mar 16 10:49:17 CET 2001
On Friday 16 March 2001 09:55, Ko-Kang at xtra.co.nz wrote:
> Hi,
>
> I input this command on a data matrix:
> > apply( traffic, 2, function(z){z-mean(z)})
>
> and got the following error messages:
> Error in sum(..., na.rm = na.rm) : invalid "mode" of argument
>
> Can anyone tell me what is wrong here?
Is it really a normal matrix? Because the following works here:
m <- matrix(rnorm(100), nrow=10)
apply(m,2,function(z){z-mean(z)})
(R 1.2.2 on Linux)
Cheers
Kaspar
P.S: Please refrain from sending HTML mails. Your message was all but
unreadable on my screen because I haven't the required font and my mail
client does not (yet) filter HTML to text
--
Kaspar Pflugshaupt
Geobotanical Institute
ETH Zurich, Switzerland
http://www.geobot.umnw.ethz.ch
mailto:pflugshaupt at geobot.umnw.ethz.ch
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
mailing list