Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

registry

Registry creator


Description

Function to create a registry object.

Usage

registry(entry_class = NULL, registry_class = NULL,
         validity_FUN = NULL, stop_if_missing = FALSE)

Arguments

entry_class

character string indicating a class the returned registry object will additionally inherit from (optional). Used for dispatching user-specified print and summary methods.

registry_class

character string indicating a class the registry entries will additionally inherit from (optional). Used for dispatching user-specified print and summary methods.

validity_FUN

a function accepting a new registry entry as argument for checking its validity and possibly aborting with an error message. The entry will be provided by the calling function as a list with named components (fields).

stop_if_missing

logical indicating whether the registry lookup functions should abort or just return NULL in case of no match.

Details

This is a generating function that will return a registry object whose components are accessor functions for the contained data. These are documented separately (regobj).

Author(s)

See Also

Examples

R <- registry()

R$set_field("X", type = TRUE)
R$set_field("Y", type = "character")
R$set_field("index", type = "character", is_key = TRUE,
            index_FUN = match_partial_ignorecase)
R$set_field("index2", type = "integer", is_key = TRUE)

R$set_entry(X = TRUE, Y = "bla", index = "test", index2 = 1L)
R$set_entry(X = FALSE, Y = "foo", index = c("test", "bar"), index2 = 2L)

R$get_entries("test")
R[["test", 1]]
R["test"]
R[["test"]]

registry

Infrastructure for R Package Registries

v0.5-1
GPL-2
Authors
David Meyer
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.