You can just tell the function to create 1000 random numbers. See ?runif for the specifics. The arguments are n, min, and max. 'n' is the one you are looking for. Da. -- View this message in context: http://r.789695.n4.nabble.com/Repeating-a-function-in-R-tp3640508p3640966.html Sent from the R help mailing list archive at Nabble.com.
If you want to repeat an entire function, use replicate as in replicate(15,sapply(1,function(x) runif(x))) Here, sapply(1,function(x) runif(x)) draws on uniformly distributed variable. replicate(15,...) is the wrapper function that tells to do this 15 times. The benefit here is that you can replicate a more complex function. However, if you just need 1000 random draws, I would use the easier approach I suggested above. Best, Daniel -- View this message in context: http://r.789695.n4.nabble.com/Repeating-a-function-in-R-tp3640508p3640982.html Sent from the R help mailing list archive at Nabble.com.
On 02.07.2011 20:51, Daniel Malter wrote:> You can just tell the function to create 1000 random numbers. See ?runif for > the specifics. The arguments are n, min, and max. 'n' is the one you are > looking for.Thanks for providing help on R-help, but for the future please - respond to the OP rather than to the list only - cite the OP's message so that anybody else on this mailing list understand the context of your message. Best, Uwe Ligges> Da. > > -- > View this message in context: http://r.789695.n4.nabble.com/Repeating-a-function-in-R-tp3640508p3640966.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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.