Re: [Rd] [patch] add is.set parameter to sample()

2010-03-25 Thread Andrew Clausen
Hi Martin, I re-attached the patch with a filename that will hopefully get through the filters this time. I agree that the case that you want to specify an integer is already well handled with sample.int(). I disagree that the resample() code for the set case given in the example is trivial. Th

Re: [Rd] [patch] add is.set parameter to sample()

2010-03-25 Thread Martin Maechler
> "AndrewC" == Andrew Clausen > on Tue, 23 Mar 2010 08:04:12 -0400 writes: AndrewC> Hi all, AndrewC> I forgot to test my patch! I fixed a few bugs. and this time, you even forgot to attach it (in a way to pass through the list filters). Note however, that all this seems unn

Re: [Rd] [patch] add is.set parameter to sample()

2010-03-23 Thread Andrew Clausen
Hi all, I forgot to test my patch! I fixed a few bugs. Cheers, Andrew On 22 March 2010 22:53, Andrew Clausen wrote: > Hi all, > > sample() has some well-documented undesirable behaviour. > > sample(1:6, 1) > sample(2:6, 1) > ... > sample(5:6, 1) > > do what you expect, but > > sample(6:6, 1) >

[Rd] [patch] add is.set parameter to sample()

2010-03-23 Thread Andrew Clausen
Hi all, sample() has some well-documented undesirable behaviour. sample(1:6, 1) sample(2:6, 1) ... sample(5:6, 1) do what you expect, but sample(6:6, 1) sample(1:6, 1) do the same thing. This behaviour is documented: If 'x' has length 1, is numeric (in the sense of 'is.numeric') and