Bill.Venables@CMIS.CSIRO.AU
2002-Dec-12 01:03 UTC
[Rd] R-intro: Simple manipulations/Vectors and assignment (PR #2365)
The message is a warning message, (which is new), but it still works. I guess the notes could warn you a warning was coming! We might re-think this, I suggest. It began as an example that forced you to come to grips with the recycling rule, but it is a bit obsolete now. In S-PLUS 6.x it actually fails. Perhaps we don't need to be quite so thorough about this after all and use a more normal example - for example just skip the 0 in the y assignment and change the text accordingly. Bill Venables. -----Original Message----- From: nvj@fys.ku.dk [mailto:nvj@fys.ku.dk] Sent: Thursday, December 12, 2002 9:17 AM To: r-devel@stat.math.ethz.ch Cc: R-bugs@biostat.ku.dk Subject: [Rd] R-intro: Simple manipulations/Vectors and assignment (PR#2365) Full_Name: Niels Vestergaard Jensen Version: 1.6.1 OS: Linux (Mandrake 9.0) Submission from: (NULL) (62.79.36.179) The R-intro (1.6.1 (2002-11-01)) says in Simple manipulations/Vectors and assignment: "So with the above assignments the command> v <- 2*x + y + 1generates a new vector v of length 11 constructed by adding together, element by element, 2*x repeated 2.2 times, y repeated just once, and 1 repeated 11 times." That's apparently not true:> x <- c(10.4, 5.6, 3.1, 6.4, 21.7) > y <- c(x, 0, x) > 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> v <- 2*x + y + 1Warning message: longer object length is not a multiple of shorter object length in: 2 * x + y Which was run first thing after starting R in a dir without .Rdata. I suspect R has been updated, but the R-intro has not kept up. See also: http://www.zoo.ufl.edu/bolker/emd/R/R-traps.html ______________________________________________ R-devel@stat.math.ethz.ch mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-devel