Learn R Programming

SimDesign (version 1.3)

SimFunctions: Skeleton functions for simulations

Description

This function prints skeleton versions of the required SimDesign functions to run simulations, complete with the correct inputs, class of outputs, and optional comments to help with the initial definitions. Use this at the start of your Monte Carlo simulation study. The recommended approach when using the RStudio IDE is to write the simulation template to two separate files for easier debugging/sourcing (this is the default when a filename is passed). For a didactic presentation of the package refer to Sigal and Chalmers (in press).

Usage

SimFunctions(filename = NULL, dir = getwd(), comments = FALSE, singlefile = FALSE, summarise = TRUE)

Arguments

filename
a character vector indicating whether the output should be saved to two respective files containing the simulation design and the functional components, respectively. Using this option is generally the recommended approach when beginning to write a Monte Carlo simulation
dir
the directory to write the files to. Default is the working directory
comments
logical; include helpful comments? Default is FALSE
singlefile
logical; when filename is included, put output in one files? When FALSE the output is saved to two separate files containing the functions and design definitions. Default is FALSE
summarise
include summarise function? Default is TRUE

References

Sigal, M. J., & Chalmers, R. P. (in press). Play it again: Teaching statistics with Monte Carlo simulation. Journal of Statistics Education.

Examples

Run this code

SimFunctions()
SimFunctions(comments = TRUE) #with helpful comments

## Not run: 
# 
# # write output to two files (recommended)
# SimFunctions('mysim')
# 
# # write output files to a single file with comments
# SimFunctions('mysim', singlefile = TRUE, comments = TRUE)
# ## End(Not run)

Run the code above in your browser using DataLab