R/workspace_save.R
workspace_save.Rd
This function creates a restore point for the current development environment , allowing you to save the state of your workspace for future restoration.
workspace_save(
note = "",
.dir = getOption("workspace.dir", "_workspace"),
n_threads = 2,
is_interactive = interactive()
)
Character. Default ""
. An optional note to add to the restore
point, providing additional context or information.
Character. Default getOption("workspace.dir", "_workspace")
.
Directory path to save workspace files.
Integer. Default 2
. The number of threads to use for the
saving process.
Logical. Default interactive()
. This parameter is
used for package development purposes only, and it is recommended to avoid
changing this setting.
File path of the newly created workspace file, invisibly.
The workspace_save()
function creates a restore point for the current
development environment. If this is the first time the function is executed
in a development environment, it performs the following actions:
Create '_workspace' Folder: It creates a folder named '_workspace' in the current working directory if it doesn't already exist
Ignore '_workspace' in Version Control: It adds '_workspace' to the '.gitignore' and '.Rbuildignore' files. This ensures that the folder is excluded from version control and building processes
Generate Restore Point File: It generates a restore point file with a filename following the pattern 'workspace/ws-YYYY-MM-DD-HH-MM-SSOPTIONAL NOTE.qs'
YYYY-MM-DD-HH-MM-SS represents the date and time of the restore point creation
OPTIONAL NOTE corresponds to the optional note provided as a parameter to the function
Output Log Messages: The function outputs log messages to provide feedback on the execution status of each step
Log messages starting with a green 'v' indicate successful operations
Other workspace functions:
workspace_restore()
if (FALSE) {
# Default
workspace_save()
# Add a note
workspace_save("lm model")
}