From p.dalgaard@biostat.ku.dk  Mon Nov  1 21:58:42 1999
From: p.dalgaard@biostat.ku.dk (Peter Dalgaard BSA)
Date: 01 Nov 1999 22:58:42 +0100
Subject: bug in sample (PR#305)
In-Reply-To: rgentlem@jimmy.harvard.edu's message of "Mon, 1 Nov 1999 22:33:17 +0100 (MET)"
References: <199911012133.WAA01606@pubhealth.ku.dk>
Message-ID: <x21za9ri0d.fsf@blueberry.kubism.ku.dk>

rgentlem@jimmy.harvard.edu writes:

> The following appears to be a bug in 0.90
> 
> > x<-sample(10,1:4,rep=T)
> > x
> [1] 8
> > ?sample
> >  x<-sample(10,1:4,rep=T)
> > x
> [1] 5
> 
> Of course, I forgot the syntax but I still don't like the result.

Weelll... the code seems to indicate that that is the intended result:
if length(x) == 1  and x>=1, you get samples from 1:x and since size
is non-vectorized, only the 1st element takes and you get samples of
size 1.

Splus3.4 does likewise, although it does give a warning:
  Numerical expression has 4 elements: only the first used...


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


bug in sample (PR#305)
Peter Dalgaard BSA