List all available mighty components (.R and .mustache files)
in the given repos.
A component is either a file directly in the repo, or a file named after
its directory one level down (<name>/<name>.R). Files starting with
test- are not listed.
Usage
list_components(repos, as = c("character", "list", "tibble"))Arguments
- repos
Where to look. One of:
charactervector of repo specs. Seemighty_repo().A
mighty_repo_classobject.A
listof repo specs ormighty_repo_classobjects.A
mighty_repos()collection.
Character vectors and lists are converted once with
mighty_repos(), so GitHub refs are only resolved once.- as
Format to list the components in:
"character": component names (filenames without extension)."list": metadata for each component."tibble": metadata for each component as a tibble. Requires thetibbleandtidyrpackages.
When a component exists in several repos, the metadata is taken from the first repo, as in
find_component().
Value
Depending on as:
"character":charactervector of unique component names."list":listwith one element per component, each a namedlistwithid,title,description,type,origin,method,params,depends,outputsandcode."tibble": tibble with one row per component and the same columns.
Examples
path <- system.file("examples", package = "mighty.component")
list_components(path)
#> [1] "ady"
list_components(path, as = "list") |>
str(max.level = 2)
#> List of 1
#> $ :List of 10
#> ..$ id : chr "ady.mustache"
#> ..$ title : chr "Analysis relative day"
#> ..$ description: chr "Derives the relative day compared to the treatment start date."
#> ..$ type : chr "column"
#> ..$ origin : chr "Derived"
#> ..$ method : chr "Relative day computed from treatment start date"
#> ..$ params :'data.frame': 3 obs. of 2 variables:
#> ..$ depends :'data.frame': 2 obs. of 2 variables:
#> ..$ outputs : chr "{{{variable}}}"
#> ..$ code : chr [1:10] "{{{domain}}} <- {{{domain}}} |>" " dplyr::mutate(" " {{{variable}}} = admiral::compute_duration(" " start_date = TRTSDT," ...
