[R] Alternate to for-loop

Gustaf Rydevik gustaf.rydevik at gmail.com
Mon Feb 16 17:54:27 CET 2009

On Mon, Feb 16, 2009 at 12:59 PM, megh <megh700004 at yahoo.com> wrote:
> Hi, I am trying to create a vector of length 10 (say), wherein each element
> will be average of random sample of size 100, from a distribution, say
> Normal. Can anyone please tell me without creating a "for" loop, how I can
> do that?
> Regards,
> --
> View this message in context: http://www.nabble.com/Alternate-to-for-loop-tp22035954p22035954.html
> Sent from the R help mailing list archive at Nabble.com.

as a variant of Patrick Burns code, you can write:


,and substitute another distribution for rnorm if you want.


Gustaf Rydevik, M.Sci.
tel: +46(0)703 051 451
address:Essingetorget 40,112 66 Stockholm, SE

More information about the R-help mailing list