Learn R Programming

bdc (version 1.1.6)

bdc_year_from_eventDate: Extract year from eventDate

Description

This function extracts a four-digit year from unambiguously interpretable collecting dates.

Usage

bdc_year_from_eventDate(data, eventDate = "eventDate")

Value

A data.frame containing the column "year". Year information is returned only if "eventDate" can be unambiguously interpretable from "eventDate". Years in the future (e.g., 2050) are returned as NA as well as years before 1600, which is the lower limit for collecting dates of biological specimens.

Arguments

data

A data frame containing a column with event date information.

eventDate

Numeric or date. The column with event date information.

See Also

Other time: bdc_eventDate_empty(), bdc_year_outOfRange()

Examples

Run this code
collection_date <- c(
  NA, "31/12/2015", "2013-06-13T00:00:00Z", "2019-05-20",
  "", "2013", "0001-01-00", "20", "1200"
)
x <- data.frame(collection_date)

bdc_year_from_eventDate(data = x, eventDate = "collection_date")

Run the code above in your browser using DataLab