Re: [R] random numbers selection - simple example

From: Daniel Nordlund <res90sx5_at_verizon.net>
Date: Wed, 06 Jun 2007 08:34:28 -0700


> -----Original Message-----
> From: r-help-bounces_at_stat.math.ethz.ch [mailto:r-help-bounces_at_stat.math.ethz.ch]
> On Behalf Of Jenny Barnes
> Sent: Wednesday, June 06, 2007 7:55 AM
> To: r-help_at_stat.math.ethz.ch
> Subject: Re: [R] random numbers selection - simple example
>
> You're all stars - thanks for the replies - I will go ahead and use
> sample...........
> I need to do this about 10,000 times - any suggestions for this or simply put it
> in a loop 10,000 times outputting each time to an array?
>
> Best Wishes,
>
> Jenny
>
>
> >
> >
> > use sample(c(0:42), 15, replace=T)
> >
> >hope it helps,
> >kevin

You could try something like the following

s<-matrix(sample(c(0:42), 10000*15, replace=TRUE), 10000, 15)

which will give you a 10000 row matrix with 1 sample of size 15 per row.

Hope this is helpful,

Dan

Daniel Nordlund
Bothell, WA USA



R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 06 Jun 2007 - 16:06:54 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 06 Jun 2007 - 16:31:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.