ab_json | R Documentation |
This function takes outputs from ab_scenario()
and returns a list that
can be saved as a JSON file for import into A/B Street.
ab_json( desire_lines, mode_column = NULL, time_fun = ab_time_normal, scenario_name = "test", default_purpose = "Work", ... )
desire_lines |
OD data represented as geographic lines created by
|
mode_column |
The column name in the desire lines data that contains
the mode of transport. |
time_fun |
The function used to calculate departure times.
|
scenario_name |
The name of the scenario to appear in A/B Street.
The default value is |
default_purpose |
In case a |
... |
Additional arguments to pass to |
Note: the departure time in seconds is multiplied by 10000 on conversion to a .json list object for compatibility with the A/B Street schema.
A list that can be saved as a JSON file with ab_save()
# Starting with tabular data od = leeds_od od[[1]] = c("E02006876") zones = leeds_zones ablines = ab_scenario(od, zones = zones) ab_list = ab_json(ablines, mode_column = "mode", scenario_name = "test") ab_list$scenario f = tempfile(fileext = ".json") ab_save(ab_list, f) readLines(f)[1:30] # Starting with JSON data from A/B Street (multiple trips per person) f = system.file("extdata/minimal_scenario2.json", package = "abstr") desire_lines = ab_sf(f) desire_lines json_list = ab_json(desire_lines) json_list
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.