Skip to contents

This function identifies occurrence records that correspond to fossils, based on specific search terms found in selected columns.

Usage

flag_fossil(
  occ,
  columns = c("basisOfRecord", "occurrenceRemarks"),
  fossil_terms = NULL
)

Arguments

occ

(data.frame) a data frame containing the occurrence records to be examined, preferably standardized using format_columns(). Must contain the columns specified in columns.

columns

(character) vector of column names in occ where the function will search for the term "fossil" or other fossil-related expressions. Default is c("basisOfRecord", "occurrenceRemarks").

fossil_terms

(character) optional vector of additional terms that indicate a fossil record (e.g., "paleontological", "subfossil"). Default is NULL.

Value

A data.frame that is the original occ data frame augmented with a new column named fossil_flag. Records identified as fossils receive FALSE, while all other records receive TRUE. As with all other flagging functions in RuHere, TRUE indicates that the record passed this test and is eligible for retention; FALSE indicates it failed and is flagged as potentially problematic, and can be removed using remove_flagged().

Examples

# Load example data
data("occurrences", package = "RuHere")
# Flag fossil records
occ_fossil <- flag_fossil(occ = occurrences)