prScript {tinyProject} | R Documentation |
create and/or open R scripts
Description
prScript
creates and opens a new script for edition. If the script
already exists, it opens it in the Rstudio editor.
Usage
prScript(name, template, subdir = ".", instructions = TRUE)
Arguments
name |
(optional) name of the script to create and/or open. This parameter can also include the subfolder where to save the script (see examples). |
template |
(Optional) One of "analysis", "data" or "function". Template to use for the
creation of a script. |
subdir |
subdirectory where the scripts needs to be created or opened. The
subdirectory can also be directly specified in the parameter |
instructions |
Should the created script include some instructions? |
Details
If the parameter name
is missing, then a list of existing scripts is
displayed. The user is then invited to choose one by typing the number or
name of the script he wants to open.
See Also
prSource
, prMoveScript
, prRenameScript
,
prDeleteScript
Examples
projectPath <- file.path(tempdir(), "test")
prInit(projectPath)
prScript("test")
list.files(projectPath, recursive = TRUE, include.dirs = TRUE)
prScript("myFunction", template = "function")
# Create script in a subfolder
prScript("test", subdir = "testdir")
# Or equivalently
prScript("testdir/test")