save an R session
Usage
save_jamsession(
session = get("session", envir = envir),
save_date = jamba::getDate(),
assign_session = FALSE,
do_timestamp = TRUE,
sessions_path = jamsession_paths()$sessions,
do_prompt = TRUE,
do_window_title = TRUE,
save_history = TRUE,
envir = globalenv(),
session_prefix = "inProgress_",
session_suffix = ".RData",
save_objectlist = TRUE,
objectlist_suffix = ".objectlist.txt",
verbose = TRUE,
...
)Arguments
- session
charactersession name used to name the .RData file- assign_session
logicaldefault FALSE, whether to assign 'session' in the global environment.GlobalEnv, to the session.- do_timestamp
logicaldefault TRUE, whether to runutils::timestamp()so the current time and date are written into the.Rhistoryfile.- sessions_path
charactervector of one or more file paths to search for saved R sessions. Default usesjamsession_paths()$sessions.- do_prompt
logicaldefault TRUE, whether to runjamba::setPrompt()to set the R prompt to include the session name.- do_window_title
logicaldefault TRUE, whether to update the graphics device options to include the session name in the title. WhenTRUE, it callsquartz.options(),X11.options(), andwindows.options()if possible.- save_history
logicaldefault TRUE, whether to save the R command history into an.Rhistoryfile. Note that the full available R command history is saved, but this command history is subject to platform-specific limitations, and thus may not contain the entire R command history.- envir
R
environmentto save, by default the active global environmentglobalenv().- session_prefix
character, default 'inProgress_' used to identify jamsession files distinct from other 'RData' files.- session_suffix
characterdefault '.RData' used to define the filename extension.- save_objectlist
logicaldefault TRUE, whether to save a character list of objects to a separate file, so they can be searched instead of loading the entire RData file for this information.- verbose
logical whether to print verbose output.
- ...
additional arguments passed to
base::save()- date
characterdate string to use when naming the .RData file. By default the current date is used, called byjamba::getDate().
Details
This function saves the current R session to a .RData file,
and the R history to a .Rhistory file. It saves these files
to the first write-accessible path in sessions_path.
When envir is defined as something other than globalenv(),
only the R objects stored in that environment are saved.
However the R objects are saved as R objects, with no information
about the source environment.
This function may assign the global variable 'session' to the
name of the session loaded, but is not done by default
due to assign_session=FALSE.
See also
Other jamsession sessions:
grep_jamsessions(),
load_jamsession(),
show_session_versions()