This function calculates the temporal coverage of a dataset (occurrences, events, or similar) based on a specified date variable.
Usage
cov_temporal(
x,
date_var,
date_format = NULL,
tryFormats = c("%Y-%m-%d", "%Y/%m/%d"),
report = TRUE
)Arguments
- x
A data frame.
- date_var
The name of the date variable column in the data frame.
- date_format
The format of the date variable (optional).
- tryFormats
A vector of possible date formats to try if the date variable is not in a standard format.
- report
Logical value indicating whether to print the temporal coverage report.
Details
If the date_format argument is not specified, the function will attempt to determine the format
of the date variable automatically using the tryFormats vector. If the date variable is not in a standard
format, an error will be thrown.
Examples
data("borreguiles")
cov_temporal(borreguiles, date_var = "eventDate", report = TRUE)
#> Warning: The argument date_format is not specified. A default format is assumed. See function's details
#> The temporal coverage of the dataset is 1988-05-18 to 2013-10-17.
#> min_date max_date
#> 1 1988-05-18 2013-10-17