bdc_year_from_eventDate: Extract year from eventDate

View source: R/bdc_year_from_eventDate.R

bdc_year_from_eventDateR Documentation

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

Arguments

data

A data frame containing a column with event date information.

eventDate

Numeric or date. The column with event date information.

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.

See Also

Other time: bdc_eventDate_empty(), bdc_year_outOfRange()

Examples

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


brunobrr/bdc documentation built on Nov. 21, 2024, 4:18 a.m.