save_jamsession: save an R session

save_jamsessionR Documentation

save an R session

Description

save an R session

Usage

save_jamsession(
  session = get("session", envir = envir),
  assign_session = TRUE,
  save_date = jamba::getDate(),
  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

character session name used to name the .RData file

assign_session

logical whether to assign session in the global environment .GlobalEnv, to reinforce the active session. It is typically not advised to update the .GlobalEnv inside a function, however for typical use of load_jamsession() the intended result is to provide an consistent R session, and session is part of that expectation.

do_timestamp

logical whether to run utils::timestamp() so the current time and date are written into the .Rhistory file.

sessions_path

character vector of one or more file paths to search for saved R sessions. When NULL, it uses the output from jamsession_paths()$sessions.

do_prompt

logical whether to run jamba::setPrompt() to set the R prompt to include the session.

do_window_title

logical whether to set the default device window title to include the session.

save_history

logical whether to save the R command history into an .Rhistory file. 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 environment to save, by default the active global environment .GlobalEnv.

verbose

logical whether to print verbose output.

...

additional arguments passed to base::save()

date

the date string to use when naming the .RData file. By default the current date is used, called by jamba::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.

By default this function will assign the value of session to session in the global environment, unless assign_session=FALSE, in order to reinforce the active R session name, and which is shown by the R prompt by default, via calling jamba::setPrompt(). These changes are intended as visual reminders of the active R session.

See Also

Other jamsession sessions: grep_jamsessions(), list_jamsessions(), load_jamsession(), show_session_versions()


jmw86069/jamsession documentation built on June 8, 2022, 8:47 p.m.