get.holidays: Add national holidays and school breaks to long form data set

Description Usage Arguments Value Author(s) See Also Examples

View source: R/hmob_funcs.R

Description

This function takes output from the parse.long.form function and appends two columns with a binary response, where a 1 indicates that the date for that trip observation occured on a national holiday or a school break

Usage

1
get.holidays(d, hol, sch)

Arguments

d

expects output from parse.long.form (trip_durations_longform.csv)

hol

expects data object national.holidays (national_holidays_clean.csv)

sch

expects data object school.terms (school_terms_clean.csv)

Value

dataframe

Author(s)

John Giles

See Also

Other data synthesis: calc.prop.tot.trips(), calc.route.type(), calc.samp.size(), get.crossdist(), get.distance.class(), get.distance.counts(), get.distance.matrix(), get.district.names.xy(), get.district.pop(), get.duration.counts(), get.sparse.mob.matrix(), get.stay.data(), get.subsamp(), get.xy.counts(), mob.data.array(), parse.longform()

Examples

1
2
3
4
5
6
7
# Add indicator for trips that occur during national holidays or school breaks
tmp <- get.holidays(
     d=read.csv("BeyondCommuting2/trip_lengths/trip_durations_longform.csv"),
     hol=read.csv('BeyondCommuting2/data/national_holidays_clean.csv', stringsAsFactors = FALSE),
     sch=read.csv('BeyondCommuting2/data/school_terms_clean.csv', stringsAsFactors = FALSE)
)
head(tmp)

gilesjohnr/hmob documentation built on Aug. 8, 2020, 1:26 a.m.