Re: [R] Sample a vector repeatedly

2010-09-13 Thread Henrique Dallazuanna
You can try this also: Vectorize(sample, 'size')(y, 1:3) On Mon, Sep 13, 2010 at 12:30 PM, James Hudson wrote: > I’d like to sample the vector “y” repeatedly. In this dummy dataset, I’d > like to sample (and store) it 1, 2, and 3 times. > > > > Is there a straightforward way to do this without

Re: [R] Sample a vector repeatedly

2010-09-13 Thread James Hudson
Thank you Marc - the first scenario. On Mon, Sep 13, 2010 at 2:04 PM, Marc Schwartz wrote: > > On Sep 13, 2010, at 10:30 AM, James Hudson wrote: > > > I‚d like to sample the vector „y‰ repeatedly. In this dummy dataset, > > I‚d > > like to sample (and store) it 1, 2, and 3 times. >

Re: [R] Sample a vector repeatedly

2010-09-13 Thread Marc Schwartz
On Sep 13, 2010, at 10:30 AM, James Hudson wrote: > I‚d like to sample the vector „y‰ repeatedly. In this dummy dataset, I‚d > like to sample (and store) it 1, 2, and 3 times. > > Is there a straightforward way to do this without using a „for‰ loop? > > x <- c(1 :3) > > y <- c(1:10) > > (run.

[R] Sample a vector repeatedly

2010-09-13 Thread James Hudson
I’d like to sample the vector “y” repeatedly. In this dummy dataset, I’d like to sample (and store) it 1, 2, and 3 times. Is there a straightforward way to do this without using a “for” loop? x <- c(1 :3) y <- c(1:10) (run.sample <- sample (y, x)) Thanks very much, James Hudson