[R] Is this a bug with a simple arithmetic operation with a vector object?

Bill Simpson wsi at gcal.ac.uk
Sun Apr 1 11:01:43 CEST 2001


R is working properly:

> x <- -c(1,2,3,4,5,6)
> x
[1] -1 -2 -3 -4 -5 -6
>  X <- -c(10,11,12,100,-5,-6)
> X
[1]  -10  -11  -12 -100    5    6
> x+X
[1]  -11  -13  -15 -104    0    0


If this is not what you expected, then you must have meant:

x <- c(1,2,3,4,5,6)

etc

You negated the vectors with a minus sign in front of the c(). The
assignment operator is <-, not <- -


Bill

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