[R] list arithmetic
Trenkler, Dietrich
dtrenkler at nts6.oec.uni-osnabrueck.de
Tue Apr 18 15:24:04 CEST 2000
I'm an old APL fossil and I got used to work with nested arrays there.
In APL(2) you can write 1+(1 2 3)(4 5 6 7 8 9) and get (2 3 4)(5 6 7 8 9
10).
A similar concept is R's lists. So it takes me by surprise to learn that
1+list(1:3,4:9)
delivers an
Error in 1 + list(1:3, 4:9) : non-numeric argument to binary operator
Is there any particular reason why this doesn't work as expected? I know
that
lapply(list(1:3,4:9),"+",y=1)
is an alternative but I hold that 1+list(1:3,4:9) looks more
straightforward.
--- D.Trenkler ---
************************************************************************
*********
Dietrich Trenkler
(trenkler at oec.uni-osnabrueck.de)
Statistik / Empirische Wirtschaftsforschung
Universitaet Osnabrueck
Rolandstrasse 8 Phone: +49(0)
541-969-2753
D-49069 Osnabrueck Fax : +49(0) 541-969-2744
GERMANY
************************************************************************
*********
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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