adjust_speed: Adjust the speeds of a gps-like table created with gtfs2gps
Description
Some GTFS.zip data sets might have quality issues, for example
by assuming that a trip speed is unreasonably high (e.g. an urban bus running
over 100 Km/h), or in other cases the `timestamp` information might be
missing for some route segments. This can lead a gps-like table to have `NA`
or unrealistic `speed` and `timestamp` values. This function allows the
user to adjust the speed of trips and updates `timestamp` values
accordingly. The user can adjust the problematic speeds by either setting a
custom constant value, or by considering the average of all valid trips speed
(Default). The columns `timestamp` and `cumtime` are updated accordingly.
A GPS-like data with adjusted `speed` values. The columns
`timestamp` and `cumtime` are also updated accordingly.
Arguments
gps_data
A GPS-like data.table created with gtfs2gps.
min_speed
Minimum speed to be considered as valid. It can
be a numeric (in km/h) or a units value able to be converted to km/h. Values
below minimum speed will be adjusted. Defaults to 2 km/h.
max_speed
Maximum speed to be considered as valid. It can
be a numeric (in km/h) or a units value able to be converted to km/h. Values
above maximum speed will be adjusted. Defaults to 80 km/h.
new_speed
Speed to replace missing values as well as values
outside min_speed and max_speed range. It can
be a numeric (in km/h) or a units value able to be converted to km/h.
By default, `new_speed = NULL` and the
function considers the average speed of the entire gps data.