library(knitr) opts_chunk$set(echo = TRUE, fig.keep = TRUE, fig.path = params$fig.path) library(methods) library(tidyverse) library(DT) library(RSQLite) library(swimr)
# This is the path to the scenario SWIM databases; direct these to your # local paths. # ref_db <- "J:/swim2/ALD_1_Region_test/outputs/ALD_1_Region_test.db" ref_db <- params$ref_db db <- dbConnect(SQLite(), dbname=ref_db) # scenario_name <- "Reference" scenario_name <- params$scenario_name # Update to reflect scope of analysis. # If you wish to focus on the Metro and Bend MPOs, for instance, change `facet` # to "MPO" and facet_levels to `c("Metro", "Bend")` # facet <- "COUNTY" facet <- params$facet facet_levels <- c("Multnomah", "Washington", "Clackamas") # The tables will only show data from these years. years <- c(2010, 2025, 2040) # The list MPOs to plot - note that in this version "Longview/Kelos/Rainier" and "Walla Walla Valley" are dropped MPOs <- c("Albany","Bend", "Corvallis", "Eugene/Springfield","Medford", "METRO", "METRO_CLARK","Middle Rogue", "NonMPO", "Halo", "Salem/Keizer") # The leaflet plots show a comparison between the scenarios in a specific year. # Set this to the year you wish to study. # diff_year <- 2040 diff_year <- params$diff_year # show leaflet plots; FALSE will skip them (saving disk space and time) # use_leaflet <- FALSE use_leaflet <- params$use_leaflet
# update to reflect current scenario scen_info <- tibble( Name = basename(ref_db), Scenario = scenario_name, `File date` = file.info(ref_db)$mtime ) kable(scen_info, caption = "Scenario Information")
if(use_leaflet){ change_leaflet(db, year1 = 2010, year2 = diff_year) } else { print("Leaflet plots skipped with `use_leaflet` option") }
se <- extract_se(db, "MPO") %>% filter(year %in% years)
pop <- se %>% filter(var == "population") %>% yearly_summary(group = "color_var", var = "y") kable(pop, caption = "Population by MPO", digits = 2)
emp <- se %>% filter(var == "employment") %>% yearly_summary(group = "color_var", var = "y") kable(emp, caption = "Employment by MPO", digits = 2)
plot_sevar(db, color_var = facet, color_levels = facet_levels, controls = FALSE, index = TRUE)
plot_sevar(db, color_var = facet, color_levels = facet_levels, index = TRUE, controls = TRUE)
plot_sevar(db, color_var = "MPO")
plot_sevar(db, color_var = "MPO", index = TRUE)
plot_history(db, counties = facet_levels)
plot_countcomparison(db, 2010)
plot_countcomparison(db, 2013, TRUE)
plot_countcomparison(db, 2010) + facet_wrap(~ FacType, scales = "free")
plot_traffic_count(db, atr = c("03-011", "10-006", "03-013", "34-009", "24-022", "15-020", "03-018", "10-008"))
vmt <- extract_vmt(db, "MPO", index = FALSE) %>% filter(year %in% years) %>% group_by(year, MPO) %>% summarise(vmt = sum(vmt)) %>% yearly_summary("MPO", "vmt") kable(vmt, caption = "VMT by MPO", digits = 2)
plot_vmt(db, facet, facet_levels, index = FALSE)
plot_vmt(db, facet, facet_levels)
plot_vmt(db, "MPO")
trips <- extract_trips(db, "MPO") %>% filter(year %in% years) %>% group_by(year, facet_var) %>% summarise(trips = sum(trips)) %>% yearly_summary("facet_var", "trips") kable(trips, caption = "Total Trips by MPO", digits = 2)
tab_mode <- extract_trips(db, "MPO", facet_levels = c("METRO", "METRO_CLARK")) %>% filter(year %in% years) %>% filter(facet_var == "METRO") %>% group_by(year, mode) %>% summarise(trips = sum(trips)) %>% yearly_summary("mode", "trips") kable(tab_mode, caption = "Metro MPO Trips by Mode", digits = 2)
plot_trips(db, facet, facet_levels, share = TRUE)
plot_trips(db, share = TRUE)
plot_trips(db, facet, facet_levels, share = FALSE, index = FALSE)
plot_trips(db, share = FALSE)
plot_tlfd(db, facet, facet_levels)
plot_tlfd(db, facet, facet_levels, cumulative = TRUE)
plot_tlfd(db, "MPO", MPOs)
plot_logsums(db, facet, facet_levels)
plot_logsums(db, "MPO", c("Bend", "Corvallis", "EugeneSpringfield", "Metro", "NonMPO", "RogueValley", "SalemKeizer"))
troubleshoot_aa(db)
plot_floorspace(db, facet, facet_levels)
plot_floorspace(db)
plot_floorspace(db, facet, facet_levels, price = TRUE)
plot_floorspace(db, price = TRUE)
plot_occupancy(db, facet, facet_levels)
plot_occupancy(db)
plot_employment(db, facet, facet_levels)
plot_employment(db)
plot_gdp(db, facet, facet_levels)
plot_gdp(db)
Specifically, the ratio of workers to individuals 15 or older.
plot_wapr(db, facet, facet_levels)
plot_wapr(db, "MPO")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.