list_objects: list saved R objects

list_objectsR Documentation

list saved R objects

Description

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 from jamsession_paths()$objects.

most_recent

logical whether to return only the most recent saved entry for each session name. When most_recent is FALSE, this function returns all saved versions for all R session names.

object_prefix, object_suffix

character string used as prefix or suffix when searching each path in objects_path for matching file names. By default, files are expected to have file extension .RData.

add_stats

logical indicating 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.

Value

list containing

object_df

data.frame of R objects

object

vector of matching R object names

See Also

Other jamsession objects: grep_objects(), load_object(), save_object()

Examples

# 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);


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