Retrieve a mighty code component, supporting both built-in standards and custom components from local files.
get_component(): Returns an object of classmighty_componentcontaining the standard or custom component.get_rendered_component(): Returns an object of classmighty_component_renderedcontaining the rendered code component
When rendering a component the required list of parameters depends on the individual component. Check the documentation of the specific standard, or the local component, for details.
Usage
get_component(component)
get_rendered_component(component, params = list())Details
Processes different component types based on file extension or component name:
No extension: Looks for built-in standard components with that name.
.R: Extracts and renders custom functions..mustache: Creates components from the template files.
Examples
get_component("ady")
#> <mighty_component/R6>
#> ady: Derives the relative day compared to the treatment start date.
#> Type: derivation
#> Parameters:
#> • domain: `character` Name of new domain being created
#> • variable: `character` Name of new variable to create
#> • date: `character` Name of date variable to use
#> Depends:
#> • {{domain}}.{{date}}
#> • {{domain}}.TRTSDT
#> Outputs:
#> • {{variable}}
get_rendered_component("ady", list(domain = "advs", variable = "ASTDY", date = "ASTDT"))
#> <mighty_component_rendered/mighty_component/R6>
#> ady: Derives the relative day compared to the treatment start date.
#> Type: derivation
#> Depends:
#> • advs.ASTDT
#> • advs.TRTSDT
#> Outputs:
#> • ASTDY
#> Code:
#> advs <- advs |>
#> dplyr::mutate(
#> ASTDY = admiral::compute_duration(
#> start_date = TRTSDT,
#> end_date = ASTDT,
#> in_unit = "days",
#> out_unit = "days",
#> add_one = TRUE
#> )
#> )
