Greg Snow wrote:
> Another possibility (maybe more readable, gives the option of a list, 
> probably not faster):
> 
> Replicate(1000, rexp(15,1) )
> 

  I think that should be "replicate"

  The matrix form is quite a bit faster, but don't know if that will
matter -- times below are for doing this task (1000 x 15 replicates)
1000 times ...

> system.time(replicate(1000,replicate(1000,rexp(15,1))))
   user  system elapsed
 12.689   0.220  12.985
> system.time(replicate(1000,matrix(rexp(15000,1),ncol=15)))
   user  system elapsed
  2.512   0.452   2.976


-- 
Ben Bolker
Associate professor, Biology Dep't, Univ. of Florida
bol...@ufl.edu / www.zoology.ufl.edu/bolker
GPG key: www.zoology.ufl.edu/bolker/benbolker-publickey.asc

Attachment: signature.asc
Description: OpenPGP digital signature

______________________________________________
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