enrichwith {enrichwith} | R Documentation |
Methods to enrich list-like R objects with extra components
Description
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
Details
Depending on the object, enriching it can be a tedious task. The enrichwith package aims to streamline the task into 3 simple steps:
Use
create_enrichwith_skeleton
to produce a customisable enrichwith template.Edit the
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,
each compute_*
function takes as input the object to be
enriched and returns the corresponding new component to be added to
the object.
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.
See Also
enrich.glm
and enriched_glm
, enrich.family
, enrich.link-glm
, enrich.betareg