Given a vector of names, return a table of the indicated data contained in a taxonomy() or taxmap() object.

obj$get_data_frame(name = NULL, ...)
get_data_frame(obj, name = NULL, ...)

Arguments

obj

A taxonomy() or taxmap() object

name

(character) Names of data to return. If not supplied, return all data listed in all_names().

...

Passed to all_names(). Used to filter what kind of data is returned (e.g. columns in tables or function output?) if name is not supplied or what kinds are allowed if name is supplied.

Value

data.frame

Details

Note: This function will not work with variables in datasets in taxmap() objects unless their rows correspond 1:1 with all taxa.

Examples

# Get specific values get_data_frame(ex_taxonomy, c("taxon_names", "taxon_indexes", "is_stem"))
#> # A tibble: 9 x 3 #> taxon_names taxon_indexes is_stem #> <chr> <int> <lgl> #> 1 Mammalia 1 FALSE #> 2 Notoryctidae 2 FALSE #> 3 Felidae 3 FALSE #> 4 Notoryctes 4 FALSE #> 5 Puma 5 FALSE #> 6 Panthera 6 FALSE #> 7 Notoryctes typhlops 7 FALSE #> 8 Puma concolor 8 FALSE #> 9 Panthera tigris 9 FALSE
# Get all values get_data_frame(ex_taxonomy)
#> # A tibble: 9 x 16 #> taxon_names taxon_ids taxon_indexes classifications n_supertaxa n_supertaxa_1 #> <chr> <chr> <int> <chr> <dbl> <dbl> #> 1 Mammalia b 1 Mammalia 0 0 #> 2 Notoryctid… c 2 Mammalia;Notor… 1 1 #> 3 Felidae d 3 Mammalia;Felid… 1 1 #> 4 Notoryctes e 4 Mammalia;Notor… 2 1 #> 5 Puma f 5 Mammalia;Felid… 2 1 #> 6 Panthera g 6 Mammalia;Felid… 2 1 #> 7 Notoryctes… h 7 Mammalia;Notor… 3 1 #> 8 Puma conco… i 8 Mammalia;Felid… 3 1 #> 9 Panthera t… j 9 Mammalia;Felid… 3 1 #> # … with 10 more variables: n_subtaxa <dbl>, n_subtaxa_1 <dbl>, n_leaves <dbl>, #> # n_leaves_1 <dbl>, taxon_ranks <chr>, is_root <lgl>, is_stem <lgl>, #> # is_branch <lgl>, is_leaf <lgl>, is_internode <lgl>