Description Usage Arguments Value Author(s) See Also Examples
This function takes a longform dataframe of trip counts and calculates the cumulative proportion of the total number of observed trips for each of
the values provided in the vals
vector.
1 2 3 4 5 6 7 8 | calc.prop.tot.trips(
variable,
counts,
type,
vals,
parallel = FALSE,
n.cores = 2
)
|
variable |
a vector of variable values for which to calculate the proportion of total trips (e.g. 'duration' or 'distance') |
counts |
a vector of observed counts of each value |
vals |
vector giving numeric values of the variable at which to calculate the proportion of total trips |
parallel |
run in parallel (when the |
n.cores |
number of cores to use in parallel |
a two-column dataframe
John Giles
Other data synthesis:
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()
,
parse.longform()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # Longform trip lengths with all metadata attached
d <- read.csv("./data/trip_durations_longform_metadata_13_34_42_85_10_14_16_99_urban_rural.csv", stringsAsFactors=F)
# Proportion of total trips with a duration less than the given values
calc.prop.tot.trips(variable=d$duration,
count=d$count,
vals=c(1,3,7),
type='cumulative')
calc.prop.tot.trips(variable=d$duration,
count=d$count,
vals=c(1,3,7),
type='interval')
# Proportion of total trips with a distance less than the given values in parallel
calc.prop.tot.trips(variable=d$distance,
count=d$count,
vals=c(1:100),
type='cumulative',
parallel=TRUE,
n.cores=4)
calc.prop.tot.trips(variable=d$distance,
count=d$count,
vals=c(1:100),
type='interval',
parallel=TRUE,
n.cores=4)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.