ab_scenario | R Documentation |
This function takes a data frame representing origin-destination trip data in 'long' form, zones and, optionally, buildings from where trips can start and end as inputs.
ab_scenario( od, zones, zones_d = NULL, origin_buildings = NULL, destination_buildings = NULL, pop_var = 3, time_fun = ab_time_normal, output = "sf", modes = c("Walk", "Bike", "Transit", "Drive"), ... )
od |
Origin destination data with the first 2 columns containing zone code of origin and zone code of destination. Subsequent columns should be mode names such as All and Walk, Bike, Transit, Drive, representing the number of trips made by each mode of transport for use in A/B Street. |
zones |
Zones with IDs that match the desire lines. Class: |
zones_d |
Optional destination zones with IDs
that match the second column of the |
origin_buildings |
Polygons where trips will originate ( |
destination_buildings |
Polygons where trips can end, represented as |
pop_var |
The variable containing the total population of each desire line. |
time_fun |
The function used to calculate departure times.
|
output |
Which output format?
|
modes |
Character string containing the names of the modes of travel to
include in the outputs. These must match column names in the |
... |
Additional arguments to pass to |
An sf
object by default representing individual trips
between randomly selected points (or buildings when available)
between the zones represented in the OD data.
od = leeds_od zones = leeds_zones od[[1]] = c("E02006876") ablines = ab_scenario(od, zones = zones) plot(ablines) table(ablines$mode) colSums(od[3:7]) # 0.17 vs 0.05 for ab_scenario ablines = ab_scenario(od, zones = zones, origin_buildings = leeds_buildings) plot(leeds_zones$geometry) plot(leeds_buildings$geometry, add = TRUE) plot(ablines["mode"], add = TRUE) ablines_json = ab_json(ablines, scenario_name = "test") od = leeds_desire_lines names(od)[4:6] = c("Walk", "Bike", "Drive") ablines = ab_scenario( od = od, zones = leeds_site_area, zones_d = leeds_zones, origin_buildings = leeds_houses, destination_buildings = leeds_buildings, output = "sf" ) plot(ablines) plot(ablines$geometry) plot(leeds_site_area$geometry, add = TRUE) plot(leeds_buildings$geometry, add = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.