R/utility_functions.R
exclude_by_velocity.Rd
Remove trajectories from a viewr object that contain instances of velocity known to be spurious.
exclude_by_velocity(obj_name, vel_min = NULL, vel_max = NULL)
obj_name | The input viewr object; a tibble or data.frame with attribute
|
---|---|
vel_min | Default |
vel_max | Default |
A new viewr object that is identical to the input object but now
excludes any trajectories that contain observations with velocity less than
vel_min
(if specified) and/or velocity greater than vel_max
(if specified)
Vikram B. Baliga
## Import and clean the example Motive data motive_import_and_clean <- import_and_clean_viewr( file_name = system.file("extdata", "pathviewR_motive_example_data.csv", package = 'pathviewR'), desired_percent = 50, max_frame_gap = "autodetect", span = 0.95 )#>## Let's remove any trajectories that contain ## velocity < 2 motive_vel_filtered <- motive_import_and_clean %>% exclude_by_velocity(vel_min = 2) ## See how the distribution of velocities has changed hist(motive_vel_filtered$velocity)