Mike.Lawrence at dal.ca
Wed May 13 17:42:57 CEST 2009
If you want k samples of size n, why generate k*n samples and put them
in a k-by-n matrix where you can do what you want to each sample:
k = 10
n = 100
If you need to do more complex things to each sample and if k is large
enough that you don't want the matrix sitting around in memory while
you do these things, you could also check out ?replicate .
On Wed, May 13, 2009 at 12:13 PM, Debbie Zhang <debbie0621 at hotmail.com> wrote:
> Dear R users,
> Can anyone please tell me how to generate a large number of samples in R, given certain distribution and size.
> For example, if I want to generate 1000 samples of size n=100, with a N(0,1) distribution, how should I proceed?
> (Since I dont want to do "rnorm(100,0,1)" in R for 1000 times)
> Thanks for help
> Looking to change your car this year? Find car news, reviews and more
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Department of Psychology
Looking to arrange a meeting? Check my public calendar:
~ Certainty is folly... I think. ~
More information about the R-help