parse.longform: Parse raw trip duration data

Description Usage Arguments Value Author(s) See Also Examples

View source: R/hmob_funcs.R

Description

This function takes the d.raw data object (trip_duration_counts.txt) or the d.raw.42 data object (trip_durations_counts_sub_42.txt) and parses the complex character string in the third column into a long form data set with date information. This function takes a while to run on the raw trip duration data, more cores are better.

Usage

1
parse.longform(d, n.cores)

Arguments

d

raw text file containing trip duration data

n.cores

number cores to use when parallel computing

Value

a dataframe with the district IDs and names of the origin and destination districts, counts of each trip duration and detailed date information

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.holidays(), get.sparse.mob.matrix(), get.stay.data(), get.subsamp(), get.xy.counts(), mob.data.array()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# process trip length data into long form data set with dates
t <- Sys.time()
tmp <- parse.longform(
     d=read.table('BeyondCommuting2/trip_lengths/trip_duration_counts.txt', header = FALSE, sep = "|"), 
     n.cores=6
)

head(tmp)

write.csv(tmp, file="BeyondCommuting2/trip_lengths/trip_durations_longform.csv", row.names=FALSE)
Sys.time() - t

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