Adds a subspecies column within taxonomic results (e.g. from
make_galah_taxonomy or make_gbif_taxonomy). Simultaneously creates a
rank_adj column that relevels any rank below subspecies to subspecies (i.e.
any rank = form or variety will have rank_adj = subspecies)
Dataframe. Probably from call to galah::search_taxa()
Ordered factor. Ideally with a match for each unique rank
in tax_res
Character. Vector of regex to remove from scientific_name before creating the subspecies column
tax_res with extra columns subspecies and rank_adj. rank will
be an ordered factor.
taxa <- c("Acacia lanigera", "Acacia lanigera var. gracilipes", "Spyridium glabrisepalum", "Spyridium eriocephalum var. glabrisepalum")
taxonomy_result <- galah::search_taxa(taxa)
#> Error in check_pour_package(.pkg): No data stored by `potions`
#> ℹ try using `brew()
make_subspecies_col(taxonomy_result) |> dplyr::select(search_term, species, subspecies, rank, rank_adj)
#> Error: object 'taxonomy_result' not found