add_taxon_order: Add taxonomic ordering number for user's custom_species

View source: R/utils.R

add_taxon_orderR Documentation

Add taxonomic ordering number for user's custom_species

Description

Places user's custom_species in the correct location in bird_list and renumbers the entire list. Operation consists of a series of joins with columns holding order numbers for different taxonomic levels. First join adds number for each distinct aou$species; this assigns same species-level number to any subspecies. Second join adds genus number for any taxa only IDed to genus. Third join adds subfamily number for any taxa only IDed to subfamily. Fourth join adds family number for any taxa only IDed to family. Final join adds add order number for any taxa only IDed to order. Then the data frame is sorted by these taxa numbers in descending taxonomical level (order, family, ...), and taxonomic.order field is regenerated as a sequential numeric field for the resulting sorted data frame.

Usage

add_taxon_order(df)

Arguments

df

Data frame. most likely the result from bind_row(bird_list, custom_species)

Value

Data frame

Examples

custom_bird_list <- bird_list %>%
dplyr::bind_rows(., custom_species) %>%
add_taxon_order()

scottfjennings/birdnames documentation built on July 2, 2023, 6:07 a.m.