Re: [Rd] proposed change to 'sample'

2010-06-21 Thread Kjetil Halvorsen
On Mon, Jun 21, 2010 at 1:57 AM, Peter Dalgaard wrote: > Hadley Wickham wrote: >>> I would be more inclined to make sampling from a vector the normal case, >>> and default x to say 1:max(n, size), forcing users to say sample(n=5) if >>> sampling from x=1:5 is desired. This could be a manageable ch

Re: [Rd] proposed change to 'sample'

2010-06-20 Thread Peter Dalgaard
Hadley Wickham wrote: >> I would be more inclined to make sampling from a vector the normal case, >> and default x to say 1:max(n, size), forcing users to say sample(n=5) if >> sampling from x=1:5 is desired. This could be a manageable change; the >> deprecation sequence is a bit painful to think t

Re: [Rd] proposed change to 'sample'

2010-06-20 Thread William Dunlap
> -Original Message- > From: Peter Dalgaard [mailto:pda...@gmail.com] > Sent: Sunday, June 20, 2010 2:12 PM > To: William Dunlap > Cc: Patrick Burns; r-devel@r-project.org > Subject: Re: [Rd] proposed change to 'sample' > > William Dunlap wrote: > &g

Re: [Rd] proposed change to 'sample'

2010-06-20 Thread Hadley Wickham
> I would be more inclined to make sampling from a vector the normal case, > and default x to say 1:max(n, size), forcing users to say sample(n=5) if > sampling from x=1:5 is desired. This could be a manageable change; the > deprecation sequence is a bit painful to think through, though. Don't we

Re: [Rd] proposed change to 'sample'

2010-06-20 Thread Peter Dalgaard
William Dunlap wrote: >> -Original Message- >> From: r-devel-boun...@r-project.org >> [mailto:r-devel-boun...@r-project.org] On Behalf Of Patrick Burns >> >> I propose adding an argument that allows >> the user (programmer) to avoid that >> ambiguity: >> >> function (x, size, replace

Re: [Rd] proposed change to 'sample'

2010-06-20 Thread William Dunlap
> -Original Message- > From: r-devel-boun...@r-project.org > [mailto:r-devel-boun...@r-project.org] On Behalf Of Patrick Burns > Sent: Sunday, June 20, 2010 3:08 AM > To: r-devel@r-project.org > Subject: [Rd] proposed change to 'sample' > > There is a w

[Rd] proposed change to 'sample'

2010-06-20 Thread Patrick Burns
There is a weakness in the 'sample' function that is highlighted in the help file. The 'x' argument can be either the vector from which to sample, or the maximum value of the sequence from which to sample. This can be ambiguous if the length of 'x' is one. I propose adding an argument that allo