search for saved R functions
Usage
grep_functions(
grep_string = ".",
save_date = ".",
functions_path = jamsession_paths()$functions,
ignore.case = TRUE,
return_df = TRUE,
most_recent = TRUE,
verbose = FALSE,
...
)Arguments
- grep_string
characterstring with regular expression pattern, although usually any text substring will work.Note that input may contain the date as seen in
rownames()oflist_functions()output. Whengrep_stringcontains multiple values, they are used in order to find matching object names, usingjamba::provigrep(). The order typically has no effect, but can be used to retain the order of objects returned even when the objects have the samesave_date.
- save_date
characterstring or vector, used as a regular expression search for matching values in thesave_datecolumn output fromlist_objects(). It can be used to search for objects with a specificsave_date. Remember to usemost_recent=FALSEwhen searching for past versions of stored R objects.- ignore.case
logicalpassed togrep()indicating whether to ignore upper and lower case, by defaultignore.case=TRUE.- return_df
logicalindicating whether to return adata.frame.- most_recent
logical whether to return only the most recent saved version of each matching object, by default
most_recent=TRUE. Note that it returns the most recent of each matching object.- verbose
logical whether to print verbose output
- ...
additional arguments are passed to
grepl().- 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.
Details
This function searches for saved R functions in the appropriate
file paths as defined in jamsession_paths(), using
jamsession_paths()$functions, or customized with
argument functions_path.
It is possible to supply multiple file paths using the
argument functions_path. All functions are returned,
sorted by save_date, then by the order of functions_path.
So a file saved on the same date will be returned by first
entry in functions_path.
When using most_recent=TRUE, only the first entry is returned,
using the most recent entry ordered by functions_path.
For example, refresh_functions(grep_functions("myfunctions"))
will load the most recent function by save_date where any
ties prefer the order in functions_path. Similarly,
refresh_functions("my_favorite_function") does the same thing,
without the grep_patten search step.
See also
Other jamsession functions:
list_functions_exports(),
refresh_functions()