Methods to enrich list-like R objects with extra components
The enrichwith package provides the
enrich method to
enrich list-like R objects with new, relevant components. The
resulting objects preserve their class, so all methods associated
with them still apply. The package can also be used to produce
customisable source code templates for the structured
implementation of methods to compute new components
Depending on the object, enriching it can be a tedious task. The enrichwith package aims to streamline the task into 3 simple steps:
create_enrichwith_skeletonto produce a customisable enrichwith template.
compute_*functions by adding the specific code that calculates the components.
Finalise the documentation and/or include more examples.
The first step results in a template that includes all necessary
functions to carry out the enrichment. The second step is where the
user edits the template and implements the calculation of the
components that the object will be enriched with. Specifically,
compute_* function takes as input the object to be
enriched and returns the corresponding new component to be added to
Everything else (for example, mapping between the enrichment options and the components that the enriched object will have, checks that an enrichment option exists, listing enrichment options, enriching the object, and so on) is taken care of by the methods in enrichwith.
Developers can either put their enrichwith templates in their packages or are welcome to contribute their template to enrichwith, particularly if that extends core R objects.
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.