This function is somewhat similar to the CPP shell command Rcopy, but it is not called.

Rcopy(
  from = NULL,
  to = NULL,
  version = NULL,
  copyright_holder = NULL,
  open = rstudioapi::isAvailable(),
  save = FALSE
)

Arguments

from

path of original R, Rmd, or qmd file. Defaults to the path of the source editor context.

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.

save

logical indicating whether to save files prior to copy.

Value

invisibly returns NULL.

See also

Rcopy_shared_code for simpler copying from the shared-code repository; Redit for creating R programs

Examples

if (FALSE) { # \dontrun{
# Copy an R program from some directory to the working directory with the same file name
Rcopy("../../d1pk/R/file.R")

# Copy an R program from some directory to the working directory with a new name
Rcopy("../../d1pk/R/file.R", "new-file.R")

# Copy the active R program to the working directory with the same file name
Rcopy()

# Copy the active R program to the working directory with a new name
Rcopy(to = "new-file.R")

# R Markdown works too
Rcopy("markdown-file.Rmd", "new-markdown-file.Rmd")

} # }