Finds common names for taxa based on highest frequency of occurrence in data using make_attribute.
Compared to a straight run of make_attribute, this function first attempts to match a taxa to a
common name based on only common names belonging to taxa names of the same rank (i.e. species names will only
be matched to species level common names if they occur in the data). Taxa that cannot be matched to a common
name at their taxonomic rank will be given a common name from a lower level (e.g. a species without a species
level match will be given the most frequently occurring subspecies common name).
make_common(
df,
taxa_col = "original_name",
common_col = "common",
taxonomy = taxonomy,
max_guess = "species",
context = "kingdom",
remove_strings = c("n/a", "''", "NA", "N/A", "^\\s*$"),
use_aoi = NULL,
df_x = "long",
df_y = "lat",
crs_df = 4326
)Dataframe with taxa_col and common_col, and optionally x, y coordinate columns if use_aoi == TRUE.
Character name of column in df that was passed to get_taxonomy as taxa_col.
Character name of column in df that contains the common names.
List resulting from call to make_taxonomy().
Character. If common name values are not available for taxa, try guessing from values up to max_guess
level of taxonomic hierarchy. See lurank. Note it does not make sense to provide a rank here that is lower than
the target_rank provided to make_taxonomy when taxonomy was made.
Any other columns in df to maintain throughout summarising.
Character. Any values in common_col to exclude.
sf. Name of sf object for filtering data for common name generation using envClean::filter_geo_range.
Character. Name of column with x coordinate.
Character. Name of column with y coordinate.
Anything that will return a legitimate crs when passed to the crs attribute of st_transform or st_as_sf.
Dataframe with one row for each taxa with best guess at a common name based on the values in common_col.