[R] rnorm
Ben Bolker
bolker at ufl.edu
Fri Jul 17 00:01:16 CEST 2009
Steve Lianoglou-6 wrote:
>
> Hi,
>
> On Jul 16, 2009, at 4:54 PM, Jose Narillos de Santos wrote:
>
>> Hi I want to simulate random numbers normal distributed with this size
>> (2000,10000).
>>
>> I tried this but my computer exhaust there is a fast way to make it?
>>
>>
>> randz<-matrix(rnorm(2000000),2000,10000)
>
>
> I'll refrain from asking if you really need/want to do that, so I'll
> just suggest that as a start you could look at the "bigmemory" package
> for an alternative way to deal with massive matrices:
>
> http://cran.r-project.org/web/packages/bigmemory/index.html
>
> -steve
>
> --
> Steve Lianoglou
> Graduate Student: Physiology, Biophysics and Systems Biology
> Weill Medical College of Cornell University
>
> Contact Info: http://cbio.mskcc.org/~lianos/contact
>
>
Hmmm. I was going to ask "why do you want to do that?", but then I tried it
and was
surprised that it wasn't particularly difficult ...
system.time(m <- matrix(rnorm(2e7),ncol=1000))
user system elapsed
5.628 0.376 6.029
this is on a not *terribly* fast computer (1.2 GHz processor) -- are your
results much slower? Do you want to do this many many times (in which case
I'd ask again "why?")
[In fact, what you actually did was even faster
system.time(randz<-matrix(rnorm(2000000),2000,10000))
user system elapsed
0.732 0.164 0.894
I'm curious whether you really intended to pick 2e6 values and put them
into a matrix with space for 2e7 values ...]
--
View this message in context: http://www.nabble.com/rnorm-tp24524329p24524845.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list