[R] Example in R-intro "Vector arithmetic" is wrong

Holger Schurig holgerschurig at gmx.de
Sun Jun 9 20:44:27 CEST 2002


In Chapter "Vector arithmetic":

------------------
constant is simply repeated.  So with the above assignments the command

   > v <- 2*x + y + 1
------------------

yields a

> v <- 2*x + y + 1
Warning message:
longer object length
        is not a multiple of shorter object length in: 2 * x + y

This is because

> x
[1] 10.4  5.6  3.1  6.4 21.7
> y
 [1] 10.4  5.6  3.1  6.4 21.7  0.0 10.4  5.6  3.1  6.4 21.7

Because one example was "y <- c(x, 0, x).

-- 
Holger Schurig        http://home.nikocity.de/hschurig/
Gartenstr. 26         phone:  +49-6034-906230
61206 Ober-Wöllstadt  mobile: +49-174-6827854

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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