bdc_year_outOfRange: Identify records with year out-of-range

View source: R/bdc_year_outOfRange.R

bdc_year_outOfRangeR Documentation

Identify records with year out-of-range

Description

This function identifies records out-of-range collecting year (e.g., in the future) or old records collected before a year informed in 'year_threshold'.

Usage

bdc_year_outOfRange(data, eventDate, year_threshold = 1900)

Arguments

data

A data frame containing a column with event date information.

eventDate

numeric or date. The column containing event date information.

year_threshold

numeric. A four-digit year threshold used to flag old (potentially invalid) records. Default = 1900

Details

Following the "VALIDATION:YEAR_OUTOFRANGE" Biodiversity data quality group, the results of this test are time-dependent. While the user may provide a lower limit to the year, the upper limit is defined based on the year when the test is run. Lower limits can be used to flag old, often imprecise, records. For example, records collected before GPS advent (1980). If 'year_threshold' is not provided, the lower limit to the year is by default 1600, a lower limit for collecting dates of biological specimens. Records with empty or NA 'eventDate' are not tested and returned as NA.

Value

A data.frame containing the column ".year_outOfRange". Compliant (TRUE) if 'eventDate' is not out-of-range; otherwise "FALSE".

See Also

Other time: bdc_eventDate_empty(), bdc_year_from_eventDate()

Examples

collection_date <- c(
  NA, "31/12/2029", "2013-06-13T00:00:00Z", "2013-06-20",
  "", "2013", 1650, "0001-01-00"
)
x <- data.frame(collection_date)

bdc_year_outOfRange(
data = x, 
eventDate = "collection_date", 
year_threshold = 1900)


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