Process Trip Data with District Information
process_trip_data.Rd
Retrieves and processes trip data from the PDS API by adding district information from community metadata. Filters out unrealistic trips longer than 48 hours to remove outliers and prepares data for monthly statistics calculation.
Value
A processed data frame with:
district: District name (from community metadata)
community: Community name
trip: Trip identifier
boat: Boat identifier
landing_date: Date of trip landing
date_month: First day of landing month
duration_hrs: Trip duration in hours
Details
The function:
Calls
get_trips()
API to retrieve trip data for specified IMEIsConverts timestamps to landing dates and monthly periods
Calculates trip duration in hours from seconds
Joins with community metadata to add district information
Filters out unrealistic trips (>48 hours)
Standardizes column names and structure
See also
calculate_monthly_trip_stats()
for using processed trip dataget_trips()
for the underlying API callget_metadata()
for community metadata retrieval
Examples
if (FALSE) { # \dontrun{
# Process trip data with parameters and device list
pars <- read_config()
trips_stats <- process_trip_data(
pars = pars,
imei_list = imei_list
)
# Check data structure
str(trips_stats)
} # }