
Check if AVL data 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
Fritsch-Carlson constraints for speeds
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 for slopes be checked? Default is
FALSE, where the speed check will returnNA.- return_full
Optional. Should a dataframe of each point checked be returned? Default is
FALSE.
Examples
# Get & test non-monotonic dataset
lineE_dists <- new_transittraj_data("get_linear_distances")
lineE_dists_val <- validate_monotonicity(lineE_dists, check_speed = TRUE)
print(lineE_dists_val)
#> weak strict speed
#> FALSE FALSE FALSE
# Get & test monotonic dataset
lineE_mono <- new_transittraj_data("make_monotonic")
lineE_mono_val <- validate_monotonicity(lineE_mono, check_speed = TRUE)
print(lineE_mono_val)
#> weak strict speed
#> TRUE TRUE TRUE