script.copy | R Documentation |
This function saves a copy of the current script in RStudio. By default, a
folder called _R_Script_Archive
will be created to save the copy of
the current R script with the current date and time into the folder. Note that
the current R script needs to have a file location before the script can be
copied.
script.copy(file = NULL, folder = "_R_Script_Archive", create.folder = TRUE,
time = TRUE, format = "%Y-%m-%d_%H%M", overwrite = TRUE,
check = TRUE)
file |
a character string naming the file of the copy without
the file extension |
folder |
a character string naming the folder in which the file
of the copy is saved. If |
create.folder |
logical: if |
time |
logical: if |
format |
a character string indicating the format if the |
overwrite |
logical: if |
check |
logical: if |
This function uses the getSourceEditorContext()
function in the
rstudioapi package by Kevin Ushey, JJ Allaire, Hadley Wickham, and Gary
Ritchie (2023).
Takuya Yanagida takuya.yanagida@univie.ac.at
Ushey, K., Allaire, J., Wickham, H., & Ritchie, G. (2023). rstudioapi: Safely access the RStudio API. R package version 0.15.0 https://CRAN.R-project.org/package=rstudioapi
script.new
, script.close
, script.open
, script.save
, setsource
## Not run:
# Example 1: Save copy current R script into the folder '_R_Script_Archive'
script.copy()
# Exmample 2: Save current R script as 'R_Script.R' into the folder 'Archive'
script.copy("R_Script", folder = "Archive", time = FALSE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.