check_date_sequence {cleanepi} | R Documentation |
Checks whether the order in a sequence of date events is chronological. order.
Description
Checks whether a date sequence in a vector of specified columns is in chronological order or not.
Usage
check_date_sequence(data, target_columns)
Arguments
data |
The input |
target_columns |
A |
Value
The input dataset. When found, the incorrect date sequences will be
stored in the report and can be accessed using
attr(data, "report")
.
Examples
# import the data
data <- readRDS(system.file("extdata", "test_df.RDS", package = "cleanepi"))
# standardize the date values
data <- data %>%
standardize_dates(
target_columns = c("date_first_pcr_positive_test", "date.of.admission"),
error_tolerance = 0.4,
format = NULL,
timeframe = NULL
)
# check the date sequence in two columns
good_date_sequence <- check_date_sequence(
data = data,
target_columns = c("date_first_pcr_positive_test", "date.of.admission")
)