translate_bird_names: Translating bird names

View source: R/translate_bird_names.R

translate_bird_namesR Documentation

Translating bird names

Description

Translate bird names between common name, alpha code, sci name, etc. Can be used to convert a dataframe column or add a new one.

Usage

translate_bird_names(x, from.name, to.name)

Arguments

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")

Details

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.

Value

character. If there are no matches for x in bird_list$from.name (or custom_bird_list, if specified), then returns tolower(x)

Examples


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

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