View source: R/translate_bird_names.R
translate_bird_names | R Documentation |
Translate bird names between common name, alpha code, sci name, etc. Can be used to convert a dataframe column or add a new one.
translate_bird_names(x, from.name, to.name)
x |
Character of the bird name you want to change |
from.name |
The bird name format of x. Can be one of c("alpha.code", "common.name", "order", "family", "subfamily", "genus", "species", "species.number") |
to.name |
The desired output bird name format. Can be one of c("alpha.code", "common.name", "order", "family", "subfamily", "genus", "species", "species.number") |
from.name must be the format of x. E.g., if the x object contains alpha codes, then from.name should be "alpha.code".
A custom bird list can be specified as "custom_bird_list" to include user-defined "species" that aren't present in the included "bird_list" dataset. If "custom_bird_list" is not specified, then the included "bird_list" dataset is used as name reference.
character. If there are no matches for x in bird_list$from.name (or custom_bird_list, if specified), then returns tolower(x)
bird_data <- data.frame(alpha.code = c("LTDU", "MALL", "GRSC"))
bird_data <- bird_data %>%
dplyr::mutate(common.name = translate_bird_names(alpha.code, "alpha.code", "common.name"),
scientific.name = translate_bird_names(alpha.code, "alpha.code", "species"))
bird_data
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.