list saved R objects
Usage
list_objects(
objects_path = jamsession_paths()$objects,
most_recent = FALSE,
object_prefix = "",
object_suffix = "[.]RData$",
add_stats = FALSE,
...
)Arguments
- objects_path
character vector of one or more file paths to search for saved R objects. When
objects_path=NULL, it uses the output fromjamsession_paths()$objects.- most_recent
logical whether to return only the most recent saved entry for each session name. When
most_recentisFALSE, this function returns all saved versions for all R session names.- object_prefix, object_suffix
characterstring used as prefix or suffix when searching each path inobjects_pathfor matching file names. By default, files are expected to have file extension.RData.- add_stats
logicalindicating whether to include summary stats for each object.- ...
additional arguments are ignored.
Details
This function lists saved R objects for the given objects_path,
usually called by grep_objects().
When most_recent=TRUE it returns only the most recent version
of each file.
It is possible to supply multiple file paths using the
argument objects_path, in which case all objects are returned
for all directories, then they are sorted by save_date.
The input objects_path is stored as an ordered factor, such
that two files with the same save_date will still be ordered
consistent with the input directories in objects_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 objects_path.
In practice, it is recommended to use one objects_path
location, but this option exists.
For example, load_object(grep_objects("my_favorite_object"))
will load the most recent object by save_date where any
ties prefer the order in objects_path. Similarly,
load_object("my_favorite_object") does the same thing,
without the grep_patten search step.
See also
Other jamsession internals:
clean_jamsession_name(),
fileInfo(),
list_functions(),
list_jamsessions(),
print_pkg_description()
Examples
if (FALSE) { # interactive()
# by default the full list includes all past versions
head(list_objects());
# you can return only the most recent for each object
list_objects(most_recent=TRUE);
# add_stats makes sense when most_recent=TRUE
list_objects(most_recent=TRUE, add_stats=TRUE);
}