Interact with a shared code directory on the file system.

path_shared_code()

browse_shared_code()

list_files_shared_code()

Rcopy_shared_code(
  from,
  to = NULL,
  version = NULL,
  copyright_holder = NULL,
  open = rstudioapi::isAvailable()
)

Arguments

from

relative path of an R program in the shared code directory.

to

path or directory of new file. If to is a directory, from is copied to that directory. Defaults to the basename of the from file.

version

either NULL for the current R version, or a character in the form "N.n.n" or "Nnn".

either NULL for the default Simulations Plus copyright statement, a single character defining the copyright holders and accompanying text to follow copyright mark and year, a character vector for multiple separate copyright statements, or FALSE for no copyright.

open

logical indicating whether to open files in RStudio.

Examples

if (FALSE) { # \dontrun{
# set the option that points to the shared code directory
options(utilscognigen.path_shared_code = "/path/to/shared-code")

# access the shared code directory path
path_shared_code()

# list files to see what's available
list_files_shared_code()

# or browse
browse_shared_code()

# copy a program with a new name
Rcopy_shared_code("templates/qc/dm-striking-qc.R", "qc-my-dataset.R")

# keep the original name
Rcopy_shared_code("templates/qc/dm-striking-qc.R")

# shorthand matching of file names is also supported
Rcopy_shared_code("dm-striking-qc")

# write to a different directory
Rcopy_shared_code("dm-striking-qc", "../asmbdat")

} # }