This function extracts a four-digit year from unambiguously interpretable collecting dates.
bdc_year_from_eventDate(data, eventDate = "eventDate")
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.
Other time:
bdc_eventDate_empty()
,
bdc_year_outOfRange()
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")
#>
#> bdc_year_from_eventDate:
#> Four-digit year were extracted from 6 records.
#> collection_date year
#> 1 <NA> NA
#> 2 31/12/2015 2015
#> 3 2013-06-13T00:00:00Z 2013
#> 4 2019-05-20 2019
#> 5 NA
#> 6 2013 2013
#> 7 0001-01-00 1
#> 8 20 NA
#> 9 1200 1200