Chuck Cleland wrote:

        <snip>

> Why use a loop here at all?  It seems like this would do it pretty fast:
> 
> Re <- rnorm(n = 2e+06, mean = - 1)
> 
> > system.time(Re <- rnorm(n = 2e+06, mean = - 1))
> [1] 0.77 0.01 0.78   NA   NA
> 
>   I'm not sure what you expect Re to be (a list with 100000 vectors of
> length 20?), but you could reshape one long vector into a matrix or
> whatever you might need.  For example:
> 
> Re.mat <- matrix(Re, ncol=20)

        <snip>

        Ummmmmm, not that it really matters, but doesn't the
        original construction (x-2*10)/20, give variates with
        mean = -1 and standard deviation = 1/20 = 0.05?

        (One wonders why ``(x-2*10)/20'' rather than ``(x-20)/20'',
        even if one allows for doing the operation in this
        convoluted way.)

        It might be added that ``Re'' is not a good name for
        an object since it is the name of a function (which
        returns the real part of complex numbers).

                                cheers,

                                        Rolf Turner
                                        [EMAIL PROTECTED]

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

Reply via email to