Re: bug in sample (PR#305)

About this list Date view Thread view Subject view Author view Other groups

Subject: Re: bug in sample (PR#305)
From: Peter Dalgaard BSA (p.dalgaard@biostat.ku.dk)
Date: Tue 02 Nov 1999 - 07:58:42 EST


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


About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b25 : Tue 04 Jan 2000 - 14:16:09 EST