Confirms that the input object is a valid taxonomy and returns it as a
taxonomy with the appropriate madshapR::class
attribute. This function
mainly helps validate input within other functions of the package but could
be used to check if a taxonomy is valid.
as_taxonomy(object)
A potential taxonomy to be coerced.
A list of data frame(s) with madshapR::class
'taxonomy'.
A taxonomy is a classification schema that can be defined for variable
attributes. A taxonomy is usually extracted from an
Opal environment, and a
taxonomy object is a data frame that must contain at least the columns
taxonomy
, vocabulary
, and terms
. Additional details about Opal
taxonomies are
available online.
{
# use madshapR_DEMO provided by the package
###### Example
as_taxonomy(madshapR_DEMO$taxonomy_PARIS)
}
#> # A tibble: 6 × 7
#> index_taxonomy index_vocabulary index_term taxonomy_id taxonomy vocabulary
#> * <dbl> <dbl> <dbl> <chr> <chr> <chr>
#> 1 1 1 1 description::t… descrip… type
#> 2 1 1 2 description::t… descrip… type
#> 3 1 1 3 description::t… descrip… type
#> 4 1 2 4 description::l… descrip… level
#> 5 1 2 5 description::l… descrip… level
#> 6 1 2 6 description::l… descrip… level
#> # ℹ 1 more variable: term <chr>