R/simulation_skeleton.R

Defines functions create_skeleton

Documented in create_skeleton

#' @title Open a simulation skeleton
#'
#' @description
#' Creates and opens a .R file containing a skeleton for writing a Monte Carlo simulation study.
#'
#'
#' @export
#'
#' @examples
#' \dontrun{
#' create_skeleton()
#' }

create_skeleton <- function() {

  from <- system.file("templates", "simulation_skeleton.R", package = "simhelpers")
  file_contents <- readLines(from, encoding = "UTF-8")

  rstudioapi::documentNew(text = paste0(file_contents, collapse = "\n"), type = "r")

  return(NULL)
}

#------------------------------------------------------

Try the simhelpers package in your browser

Any scripts or data that you put into this service are public.

simhelpers documentation built on May 4, 2022, 1:05 a.m.