Calculate tour weights for each person
calc_tour_weights.RdCalculates tour weights for each person in each household by averaging unlinked trip weights within tour groups. Use to generate tour weights for downstream analysis.
Usage
calc_tour_weights(
tours,
unlinked_trips,
unlinked_trip_weights,
day_weights,
settings,
ignore_checks = FALSE
)Arguments
- tours
data.table with required columns:
tour_idhh_idperson_idday_idday_groupRows: one per tour. Keys: ( tour_id). Modified by reference: no (returns copy).
- unlinked_trips
data.table. Unlinked trip-level variables.
- unlinked_trip_weights
data.table. Unlinked trip weights.
- day_weights
data.table. Day-level weights.
- settings
list. Pipeline settings object.
- ignore_checks
logical. If TRUE, skips consistency checks.
Value
data.table with columns:
hh_idperson_idday_idtour_idday_grouptour_weightRows: one per tour. Keys: ( tour_id).
Details
Joins tour IDs to unlinked trip weights.
Averages unlinked trip weights by tour ID.
Checks consistency with day weights unless ignore_checks is TRUE.
Returns a copy; does not modify by reference.
See also
calc_trip_weightsscripts/weighting/tour_weights.R
Other weighting pipeline:
aggregate_targets(),
calc_day_weights(),
calc_linked_trip_weights(),
calc_person_weights(),
calc_sample_plan_counts(),
calc_trip_weights(),
create_ie_adjustment_data(),
create_target_update_table(),
format_income_bins(),
get_day_groups(),
get_income_broad(),
get_income_broad_xwalk(),
prepare_zone_groups(),
update_daypat_seed(),
update_daypat_targets(),
update_income_broad_labels(),
update_rate_report(),
update_targets()
Examples
## Not run:
tours <- data.table(tour_id = "T1", hh_id = 1, person_id = 1, day_id = 1, day_group = "weekday")
unlinked_trips <- data.table()
unlinked_trip_weights <- data.table()
day_weights <- data.table()
settings <- list()
calc_tour_weights(tours, unlinked_trips, unlinked_trip_weights, day_weights, settings)
#> Error in colnamesInt(x, names(on), check_dups = FALSE): argument specifying columns received non-existing column(s): cols[1]='trip_id'
## End(Not run)