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.

______________________________________________
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