R-alpha: inconsistency R/Splus of sample()
Ross Ihaka
ihaka@stat.auckland.ac.nz
Fri, 5 Sep 1997 10:44:51 +1200 (NZST)
Friedrich Leisch writes:
>
> 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.
Done. (A one character change).
Ross
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-