Dear Debbie,
Here are two options:

# Parameters
N <- 1000
n <- 100

# Option 1
mys <- replicate(N, rnorm(n))
mys

# Option 2
mys2 <- matrix(rnorm(N*n),ncol=N)
mys2

HTH,

Jorge


On Wed, May 13, 2009 at 11:13 AM, Debbie Zhang <debbie0...@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
>
>
>
> Debbie
>
> _________________________________________________________________
> Looking to change your car this year? Find car news, reviews and more
>
>
> e%2Ecom%2Fcgi%2Dbin%2Fa%2Fci%5F450304%2Fet%5F2%2Fcg%5F801459%2Fpi%5F1004813%2Fai%5F859641&_t=762955845&_r=tig_OCT07&_m=EXT
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org 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.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to