R-alpha: lazy evaluation and plot.step()

Kurt Hornik Kurt.Hornik@ci.tuwien.ac.at
Tue, 22 Apr 1997 15:50:43 +0200


Today I received an email which made me realize that what I wrote in the
FAQ explaining the different behavior of Martin's plot.step() under R
and S is not really true.

Does someone understand what is going on in the following?

"test" <-
function(x, y, xlab = deparse(substitute(x)), ylab = deparse(substitute(y)))
{
  x <- sort(x)
  print(xlab)
  n <- length(x)
  y <- (1:n) / n
  print(ylab)
}

Under R,

R> test(4:1)
[1] "c(1, 2, 3, 4)"
[1] "c(0.25, 0.5, 0.75, 1)"
R> test(4:1, 4)
[1] "c(1, 2, 3, 4)"
[1] "c(0.25, 0.5, 0.75, 1)"

Under S,

> test(4:1)
[1] "4:1"
[1] ""
[1] ""
> test(4:1, 4)
[1] "4:1"
[1] "c(0.25, 0.5, 0.75, 1)"
[1] "c(0.25, 0.5, 0.75, 1)"

???

-k
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-devel 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-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-