R-alpha: inconsistency R/Splus of sample()

Friedrich Leisch Friedrich.Leisch@ci.tuwien.ac.at
Thu, 4 Sep 1997 10:52:24 +0200


The function sample has different behaviour under R and Splus when
called with zero sample size:

R> x<-rnorm(10)
R> sample(x,0)
Error in sample(length(x), size, replace) : invalid second argument

Splus> x<-rnorm(10)
Splus> sample(x,0)
numeric(0)


IMO the Splus behaviour makes more sense, because it returns the
requested `sample' of size 0.

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