From possolo@crd.ge.com  Thu Dec 13 14:41:07 2001
From: possolo@crd.ge.com (possolo@crd.ge.com)
Date: Thu, 13 Dec 2001 15:41:07 +0100 (MET)
Subject: [Rd] sample (PR#1212)
Message-ID: <200112131441.PAA07523@pubhealth.ku.dk>

Full_Name: Antonio Possolo
Version: 1.3.1
OS: Linux (RH 7.1), Windows 2000
Submission from: (NULL) (192.35.44.3)


A FEATURE THAT EASILY GENERATES BUGS

sample(pi, size=1) produces 1, 2, or 3.
sample(c(pi, pi), size=1) produces 3.141593 always.

Although this conforms with the behavior explained in the help page for
"sample",
the behavior for the case where x (in sample(x, ...)) has length 1 can easily
lead to errors if x is generated automatically and one neglects to check its
length before sampling from it.

I believe it would be safest to require x to be always the full set of values
one wishes to sample from, and remove the special meaning that is attached
to the case when x is of length 1.

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


[Rd] sample (PR#1212)
possolo@crd.ge.com