Description Usage Arguments Details Value Note Author(s) Examples
A simple function to repeat an expression several times as an aid to simplifying simulations.
| 1 | pmgRepeatTrials(expr, n = 10)
 | 
| expr | An R expression, such as  | 
| n | Number of times to repeat the expressions. The default is 10. | 
This functions aids in doing simulations. Rather than explicitly write
a for loop or use sapply this function will call
sapply on the expression.
A GUI for this appears in pmg under the Simluation tab. The "quick action" will call the function on the results of the simulation.
The output of a sapply call can be a vector, matrix, ... If it
is a vector, it is transposed/
This function and GUI was suggested by Daniel Kaplan at useR!2007
John Verzani
| 1 2 3 4 5 6 7 8 9 10 11 |   res <- pmgRepeatTrials(rnorm(1))
  hist(res)
  g = data.frame(
   father = c(78.5, 78.5, 77.5, 76.0, 75.5),
   mother = c(67.0, 68.0, 66.0, 65.5, 62.0),
   sex    = c("M", "M",  "F",  "F",  "M"),
   nkids  = c(4,     4,    1,    2,    5)
  )
  res <- pmgRepeatTrials(coef(lm(father~ sex + sample(nkids),data=g)),100)
  print(res)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.