List saved R sessions
Usage
list_jamsessions(
sessions_path = jamsession_paths()$sessions,
most_recent = FALSE,
session_prefix = "^inProgress_",
session_suffix = "[.]RData$",
add_stats = FALSE,
return_type = c("df", "sessions", "list"),
...
)Arguments
- sessions_path
charactervector of one or more file paths to search for saved R sessions. WhenNULL, it uses the output fromjamsession_paths()$sessions.- most_recent
logicaldefault FALSE, whether to return only the most recent entry for each session name. Whenmost_recentisFALSEall saved versions are returned for all R session names.- session_prefix, session_suffix
characterstring used as prefix or suffix when searching each path insessions_pathfor matching file names.- add_stats
logicalindicating whether to include summary stats for each session:number_savedis the number of past versions of the session;total_sizeis the total file size for all saved versions.- ...
additional parameters are ignored
Value
data.frame by default, with sessions per row.
When return_type='sessions' it returns the unique session
names. When return_type='list' it returns a list with both
elements.
Details
This function lists available saved R sessions,
usually called by grep_jamsessions().
When most_recent=TRUE it returns only the most recent session
based upon the save_date.
It is possible to supply multiple file paths using the
argument sessions_path, in which case all sessions are returned
for all directories, then they are sorted by save_date.
The input sessions_path is stored as an ordered factor, such
that two sessions with the same save_date will still be ordered
consistent with the input directories in sessions_path.
In this case, when most_recent=TRUE there will be one entry
returned per object name, and the first entry will be the
most recent entry ordered by save_date then sessions_path.
In practice, it is recommended to use one sessions_path
location, but this option exists.
For example, jamsession(grep_sessions("my_session"))
will load the most recent session by save_date where any
ties prefer the order in sessions_path. Similarly,
load_jamsession("my_session") does the same thing,
without the grep_patten search step.
See also
Other jamsession internals:
clean_jamsession_name(),
fileInfo(),
list_functions(),
list_objects(),
print_pkg_description()
Examples
list_jamsessions();
#> session save_date days_old
#> theo-grpeaks-jul2025_25jul2025 theo-grpeaks-jul2025 25jul2025 115
#> file_size
#> theo-grpeaks-jul2025_25jul2025 439 Mb
#> session_path
#> theo-grpeaks-jul2025_25jul2025 C:/Users/james.ward/Documents/Projects/R-sessions
#> session_file
#> theo-grpeaks-jul2025_25jul2025 inProgress_theo-grpeaks-jul2025_25jul2025.RData