Check if an AVL dataframe satisfies assumptions of monotonicity.
Source:R/tides_validation.R
validate_monotonicity.RdThis function checks whether the provided AVL dataframe of linearized distances satisfies three conditions:
Weak monotonicity, either flat or increasing
Strict monotonicty, increasing only
Speeds satisfy Fritsch-Carlson constraints
See make_monotonic() for more information.
Arguments
- distance_df
A dataframe of linearized AVL data. Must include
trip_id_performed,event_timestamp, anddistance. Ifcheck_speed = TRUE, must also includespeed.- check_speed
Optional. A boolean, should the Fritsch-Carlson conditions
- return_full
Optional. Should a dataframe of each point checked be returned? Default is
FALSE. for slopes be checked? Default isFALSE, where the speed check will returnNA.
Examples
# Get & test non-monotonic dataset
c53_dists <- new_transittraj_data("get_linear_distances")
c53_dists_val <- validate_monotonicity(c53_dists, check_speed = TRUE)
print(c53_dists_val)
#> weak strict speed
#> FALSE FALSE FALSE
# Get & test monotonic dataset
c53_mono <- new_transittraj_data("make_monotonic")
c53_mono_val <- validate_monotonicity(c53_mono, check_speed = TRUE)
print(c53_mono_val)
#> weak strict speed
#> TRUE TRUE TRUE