Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 30th, 2012  |  syntax: None  |  size: 0.24 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. What's the idiomatic way in R to return a vector of function values when the function takes no input?
  2. example.f <- function() runif(1, 0, 1)
  3.        
  4. rep(example.f(), 100)
  5.        
  6. sapply(1:100, function(x) example.f())
  7.        
  8. replicate(100, example.f())