Classify day trip type
calc_day_trip_class.RdClassifies each day as 'mandatory', 'non-mandatory', or 'none' based on trip or tour purpose. Use for weighting and travel pattern analysis.
Arguments
- daypat_table
data.table with required columns:
For 'trip': day_id <character/integer>, d_purpose_category
For 'linked_trip': day_id <character/integer>, d_purpose_category
For 'tour': day_id <character/integer>, tour_purpose
Rows: one per trip/tour. Keys: (day_id). Modified by reference: no (returns copy).
- daypat_table_type
character(1). Type of day pattern table: 'trip', 'linked_trip', or 'tour'.
- days
data.table with required columns:
person_id <character/integer> — person ID
day_id <character/integer> — day ID Rows: one per day. Keys: (person_id, day_id). Modified by reference: no (returns copy).
- value_labels
data.table with required columns:
variable
— variable name value <character/integer> — coded value
label
— value label Rows: one per value. Keys: (variable, value). Modified by reference: no (returns copy).
Value
data.table with columns:
person_id <character/integer> — person ID
day_id <character/integer> — day ID
day_trip_class
— trip class Rows: one per day. Keys: (person_id, day_id). Modified by reference: no (returns copy).
Details
Uses trip, linked_trip, or tour table to determine day pattern class.
Maps purpose category to class using value labels.
Handles missing or 'other' categories robustly.
Returns a copy; does not modify by reference.
See also
scripts/modeling/calc_day_trip_class.R
Other day pattern modeling:
calc_daypat_probabilities(),
save_daypat_results()