diff --git a/_freeze/location-services/tutorials/shiny-dash/index/execute-results/html.json b/_freeze/location-services/tutorials/shiny-dash/index/execute-results/html.json index 55c1dc4..f5c00b7 100644 --- a/_freeze/location-services/tutorials/shiny-dash/index/execute-results/html.json +++ b/_freeze/location-services/tutorials/shiny-dash/index/execute-results/html.json @@ -1,8 +1,8 @@ { - "hash": "85cfed7183c64e4b6b49dac0ee8ebc5e", + "hash": "ab851b22108ac378ddd39df4791051d3", "result": { "engine": "knitr", - "markdown": "---\ntitle: \"Dashboard using ArcGIS Hosted Data\"\nsubtitle: \"Building an interactive dashboard with {arcgis}\"\nfreeze: true\nresources: \n - html/lib\n---\n\n\nIn this tutorial we will be recreating a dashboard that utilizes the data from the [City of Chattanooga Open Data Hub](https://www.chattadata.org/Public-Safety/Pedestrian-Accidents/8piy-9u9f). In the below LinkedIn post by [Charlie Mix](https://www.linkedin.com/in/charlie-mix/), they use this data to create an ArcGIS Dashboard. \n\n\n\n[Original LinkedIn Post](https://www.linkedin.com/posts/charlie-mix_arcgisdashboard-gis-activity-7135693623307767808-sbRW?utm_source=share&utm_medium=member_desktop)\n\nThe data is provided as a [Feature Service](https://services.arcgis.com/UnTXoPXBYERF0OH6/arcgis/rest/services/Vehicle_Pedestrian_Incidents/FeatureServer) by Charlie Mix, which we will use to create a lightweight interactive dashboard in R using `{arcgis}` and `{bslib}`.\n\nThe dashboard that we are going to create can be [viewed live here](https://r.esri.com/traffic-incidents-dashboard/index.html).\n\n## The Packages\n\n\nThere are 4 components to this dashboard that we will want to recreate. These are the two plots, the statistics, and the map. \n\n\nWe're going to use 9 packages to make this happen.\n\n::: {.cell}\n\n```{.r .cell-code}\n# knitr::opts_chunk$set(eval = FALSE)\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(sf)\nlibrary(bslib)\n```\n\n::: {.cell-output .cell-output-stderr}\n\n```\nWarning: package 'bslib' was built under R version 4.3.1\n```\n\n\n:::\n\n```{.r .cell-code}\nlibrary(dplyr)\nlibrary(arcgis)\nlibrary(plotly)\nlibrary(bsicons)\nlibrary(ggplot2)\nlibrary(leaflet)\n\ntheme_set(theme_minimal())\n```\n:::\n\n\n\n## Reading data from ArcGIS Online\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# open the feature server\ncrash_server <- arc_open(\"https://services.arcgis.com/UnTXoPXBYERF0OH6/arcgis/rest/services/Vehicle_Pedestrian_Incidents/FeatureServer\")\n\ncrash_server\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n>\nCRS: 32136\nCapabilities: Query\n 1: Vehicle Pedestrian Incidents (esriGeometryPoint)\n 2: Vehicle Pedestrian Incidents OptimizedHotSpotAnalysis (esriGeometryPolygon)\n```\n\n\n:::\n\n```{.r .cell-code}\n# fetch individual layers\n(incidents <- get_layer(crash_server, 1))\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n>\nName: Vehicle Pedestrian Incidents\nGeometry Type: esriGeometryPoint\nCRS: 32136\nCapabilities: Query\n```\n\n\n:::\n\n```{.r .cell-code}\n(hotspots <- get_layer(crash_server, 2))\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n>\nName: Vehicle Pedestrian Incidents OptimizedHotSpotAnalysis\nGeometry Type: esriGeometryPolygon\nCRS: 32136\nCapabilities: Query\n```\n\n\n:::\n\n```{.r .cell-code}\n# bring them into memory as sf objects\ninci_sf <- arc_select(incidents)\n```\n\n::: {.cell-output .cell-output-stderr}\n\n```\nRegistered S3 method overwritten by 'jsonify':\n method from \n print.json jsonlite\n```\n\n\n:::\n\n```{.r .cell-code}\nhs_sf <- arc_select(hotspots)\n```\n:::\n\n\n:::{.panel-tabset}\n\n### Hot Spot Analysis\n\n\n::: {.cell}\n\n```{.r .cell-code}\nglimpse(hs_sf)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\nRows: 369\nColumns: 10\n$ OBJECTID 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1…\n$ SOURCE_ID 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1…\n$ JOIN_COUNT 2, 1, 1, 1, 1, 2, 1, 6, 1, 3, 1, 1, 1, 3, 1, 3, 1, 2, 1,…\n$ GiZScore -0.40186687, -0.40186687, -0.40186687, -0.61763312, 0.76…\n$ GiPValue 0.6877820, 0.6877820, 0.6877820, 0.5368172, 0.4431177, 0…\n$ NNeighbors 3, 3, 3, 2, 10, 14, 14, 14, 7, 6, 21, 13, 6, 22, 24, 23,…\n$ Gi_Bin 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…\n$ Shape__Area 115843.3, 115848.0, 115857.5, 115909.8, 115924.1, 115933…\n$ Shape__Length 1266.954, 1266.979, 1267.031, 1267.318, 1267.396, 1267.4…\n$ geometry MULTIPOLYGON (((668610.5 95..., MULTIPOLYGO…\n```\n\n\n:::\n:::\n\n\n### Incidents\n\n\n::: {.cell}\n\n```{.r .cell-code}\nglimpse(inci_sf)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\nRows: 631\nColumns: 32\n$ OBJECTID 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,…\n$ Incident_Number \"23-008820\", \"22-130607\", \"22-108023\", \"23…\n$ Incident_Date 2023-01-25 18:00:00, 2022-12-03 18:02:00,…\n$ Time_Num 18.0, 18.0, 17.5, 1.5, 12.5, 20.5, 18.5, 9…\n$ Street \"E 11th St\", \"2000 S Kelley St\", \"Dodds Av…\n$ Alt_Street NA, NA, NA, NA, NA, \"US-11\", NA, NA, NA, \"…\n$ City \"Chattanooga\", \"Chattanooga\", \"Chattanooga…\n$ County \"Hamilton\", \"Hamilton\", \"Hamilton\", \"Hamil…\n$ Intersection \"Market St\", \"E 23rd Street\", \"E 41st St\",…\n$ Mile_Post NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…\n$ Accident_Type \"Possible Injury\", \"Property Damage Under\"…\n$ Collision_Type \"Not Collision with Motor Vehicle in Trans…\n$ Hit_and_Run \"No\", \"No\", \"No\", \"No\", \"No\", \"No\", \"No\", …\n$ Involved_Fatal_Injury \"No\", \"No\", \"No\", \"No\", \"No\", \"No\", \"No\", …\n$ Involved_Medical_Transport \"No\", \"No\", \"Yes\", \"Yes\", \"Yes\", \"Yes\", \"N…\n$ Involved_Placarded_Truck \"No\", \"No\", \"No\", \"No\", \"No\", \"No\", \"No\", …\n$ Posted_Speed 25, 20, 40, 30, 45, 45, 15, NA, 35, 45, 40…\n$ Total_Vehicles_Involved 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …\n$ Weather_Code \"Clear\", \"Clear\", \"Clear\", \"Clear\", \"Clear…\n$ Pedestrian_Involved \"Yes\", \"Yes\", \"Yes\", \"Yes\", \"Yes\", \"Yes\", …\n$ Bicycle_Involved \"No\", \"No\", \"No\", \"No\", \"No\", \"No\", \"No\", …\n$ Drug_Involved NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…\n$ Alcohol_Involved NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…\n$ Light_Condition \"Dark - Lighted\", \"Dark - Lighted\", \"Dayli…\n$ Driver_One_Safety_Equipment \"Unknown\", \"Unknown\", \"Unknown\", \"Unknown\"…\n$ Driver_One_Zip \"37411\", \"37403\", \"37421\", \"37421\", \"37404…\n$ Driver_Two_Safety_Equipment \"Shoulder and Lap Belt Used\", \"Shoulder an…\n$ Driver_Two_Zip \"30755\", \"37406\", \"37407\", \"37341\", \"32148…\n$ Latitude 35.04283, 35.01957, 34.99520, 35.08057, 35…\n$ Longitude -85.31865, -85.27885, -85.28440, -85.26217…\n$ Location_WKT \"POINT (-85.318653 35.0428324)\", \"POINT (-…\n$ geometry POINT (662169.1 78935.9), POINT (665…\n```\n\n\n:::\n:::\n\n\n:::\n\n## Creating the plots\n\n- use a combination of ggplot2 and plotly\n- ggplot2 creates the static plot\n- plotly makes it interactive\n\n\n\n::: {.cell layout-ncol=\"2\"}\n\n```{.r .cell-code}\nannual_counts <- inci_sf |>\n st_drop_geometry() |>\n mutate(year = lubridate::year(Incident_Date)) |>\n group_by(year) |>\n count() |>\n ungroup()\n\ngg_annual <- ggplot(annual_counts, aes(year, n)) +\n geom_line() +\n geom_point(size = 3) +\n labs(\n x = \"Year\",\n y = \"Incidents\"\n )\n\nspeed_counts <- inci_sf |>\n st_drop_geometry() |>\n count(Posted_Speed) |>\n filter(!is.na(Posted_Speed))\n\ngg_speed <- ggplot(speed_counts, aes(Posted_Speed, n)) +\n geom_col() +\n labs(\n x = \"Posted Speed Limit (miles per hour)\",\n y = \"Incidents\"\n )\n\ngg_annual\n```\n\n::: {.cell-output-display}\n![](index_files/figure-html/unnamed-chunk-6-1.png){width=672}\n:::\n\n```{.r .cell-code}\ngg_speed\n```\n\n::: {.cell-output-display}\n![](index_files/figure-html/unnamed-chunk-6-2.png){width=672}\n:::\n:::\n\n\nMake them interactive with plotly\n\n\n::: {.cell layout-ncol=\"2\"}\n\n```{.r .cell-code}\nggplotly(gg_annual)\n```\n\n::: {.cell-output-display}\n\n```{=html}\n
\n\n```\n\n:::\n\n```{.r .cell-code}\nggplotly(gg_speed)\n```\n\n::: {.cell-output-display}\n\n```{=html}\n
\n\n```\n\n:::\n:::\n\n\n\nWe will add these plotly widget directly into our dashboard as a tabset\n\n\n::: {.cell}\n\n```{.r .cell-code}\nplot_tab <- navset_card_tab(\n title = \"Plots\",\n nav_panel(\n \"By year\",\n card_title(\"Vehicle-Pedestrian Incidents by Year\"),\n ggplotly(gg_annual)\n ),\n nav_panel(\n \"By speed\",\n card_title(\"Vehicle Pedestrian Incidents by Posted Speed Limit\"),\n ggplotly(gg_speed)\n )\n)\n\nplot_tab\n```\n\n::: {.cell-output-display}\n\n```{=html}\n
\n
\nPlots\n\n
\n
\n
\n
\n
Vehicle-Pedestrian Incidents by Year
\n
\n\n
\n
\n
\n
\n
Vehicle Pedestrian Incidents by Posted Speed Limit
\n
\n\n
\n
\n
\n\n
\n```\n\n:::\n:::\n\n\n\n## Statistic value boxes\n\nWe want to calculate the statistics and present them in a value box. These are fairly simple statistics that we can calculate from the\n\n:::{.panel-tabset}\n\n### Base R\n\n\n::: {.cell}\n\n```{.r .cell-code}\nn_incidents <- nrow(inci_sf)\n\nn_medical_transit <- table(inci_sf$Involved_Medical_Transport)[\"Yes\"]\n\nn_fatalities <- table(inci_sf$Involved_Fatal_Injury)[[\"Yes\"]]\n\nn_alc_drug <- sum(\n inci_sf$Drug_Involved == \"Yes\" | inci_sf$Alcohol_Involved == \"Yes\", \n na.rm = TRUE\n)\n```\n:::\n\n\n### dplyr\n\n\n::: {.cell}\n\n```{.r .cell-code}\nn_incidents <- count(inci_sf) |> \n pull(n)\n\nn_medical_transit <- inci_sf |> \n count(Involved_Medical_Transport) |> \n filter(Involved_Medical_Transport == \"Yes\") |> \n pull(n)\n\nn_fatalities <- inci_sf |> \n count(Involved_Fatal_Injury) |> \n filter(Involved_Fatal_Injury == \"Yes\") |> \n pull(n)\n\nn_alc_drug <- inci_sf |> \n filter(Drug_Involved == \"Yes\" | Alcohol_Involved == \"Yes\") |> \n count() |> \n pull(n)\n```\n:::\n\n\n:::\n\n\nWe can pass these into `bslib::value_box()` to create nice looking cards. \n\n\n::: {.cell}\n\n```{.r .cell-code}\nvalue_box(\"Number of Incidents\", n_incidents)\n```\n\n::: {.cell-output-display}\n\n```{=html}\n
\n
\n
\n

Number of Incidents

\n

631

\n
\n
\n\n
\n```\n\n:::\n:::\n\nThe `showcase` argument lets us add text or images that are emphasized in the value box. Let's use bootstrap icons to add a bit of pizazz. \n\n\n::: {.cell}\n\n```{.r .cell-code}\nvalue_box(\n \"Number of Incidents\",\n n_incidents,\n showcase = bs_icon(\"person\")\n)\n```\n\n::: {.cell-output-display}\n\n```{=html}\n
\n
\n
\n
\n
\n

Number of Incidents

\n

631

\n
\n
\n
\n\n
\n```\n\n:::\n:::\n\nLet's create a card for each of these statistics and store them in their own variable. \n\n\n::: {.cell}\n\n```{.r .cell-code}\ninci_card <- value_box(\n \"Number of Incidents\",\n n_incidents,\n showcase = bs_icon(\"person\")\n)\n\nfatalities_card <- value_box(\n \"Total Fatalities\",\n n_fatalities,\n showcase = bs_icon(\"heartbreak\")\n)\n\nmedical_card <- value_box(\n \"Involved Medical Transport\",\n n_medical_transit,\n showcase = bs_icon(\"heart-pulse\")\n)\n\ndrugs_card <- value_box(\n \"Involved Drugs or Alcohol\",\n n_alc_drug,\n showcase = bs_icon(\"capsule\")\n)\n```\n:::\n\n\nLet's build out a component of our dashboard using these cards. We'll create a grid of these 4 using `layout_columns`. This will arrange bslib components into columns for us. \n\n\n::: {.cell}\n\n```{.r .cell-code}\nlayout_columns(\n inci_card, \n fatalities_card,\n medical_card, \n drugs_card\n)\n```\n\n::: {.cell-output-display}\n\n```{=html}\n
\n
\n
\n
\n
\n
\n
\n

Number of Incidents

\n

631

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Total Fatalities

\n

40

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n

Involved Medical Transport

\n

381

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Involved Drugs or Alcohol

\n

36

\n
\n
\n
\n\n
\n
\n
\n```\n\n:::\n:::\n\nBy default this will put each item in their own column. But we can specify the width of each element in grid units. In web development, user interfaces are often partitioned into grid units that are broken into twelve units. So if we want two value cards per row, we need to specify the column widths to be 6.\n\n\n::: {.cell}\n\n```{.r .cell-code}\nstats <- layout_columns(\n inci_card, \n fatalities_card,\n medical_card, \n drugs_card,\n col_widths = 6\n)\n\nstats\n```\n\n::: {.cell-output-display}\n\n```{=html}\n
\n
\n
\n
\n
\n
\n
\n

Number of Incidents

\n

631

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Total Fatalities

\n

40

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n

Involved Medical Transport

\n

381

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Involved Drugs or Alcohol

\n

36

\n
\n
\n
\n\n
\n
\n
\n```\n\n:::\n:::\n\n\n## Creating the map\n\n\n::: {.cell}\n\n```{.r .cell-code}\nhexes <- hs_sf |>\n transmute(\n classification = case_when(\n Gi_Bin == 0 ~ \"Not Significant\",\n Gi_Bin == 1 ~ \"Hot Spot with 90% Confidence\",\n Gi_Bin == 2 ~ \"Hot Spot with 95% Confidence\",\n Gi_Bin == 3 ~ \"Hot Spot with 99% Confidence\"\n )\n ) |>\n st_transform(4326)\n\n# create labels vector to pass to leaflet\ngi_labels <- c(\n \"Not Significant\",\n \"Hot Spot with 90% Confidence\",\n \"Hot Spot with 95% Confidence\",\n \"Hot Spot with 99% Confidence\"\n)\n\npal <- colorFactor(\n palette = c(\"#c6c6c3\", \"#c8976e\", \"#be6448\", \"#af3129\"),\n levels = gi_labels\n)\n\nmap <- leaflet() |>\n addProviderTiles(\"Esri.WorldGrayCanvas\") |>\n addPolygons(\n data = hexes,\n fillColor = ~pal(classification),\n color = \"#c6c6c3\",\n weight = 1,\n fillOpacity = 0.8\n ) |>\n addLegend(\n pal = pal,\n values = gi_labels,\n opacity = 1,\n title = \"Hot Spot Classification\"\n ) |>\n setView(-85.3, 35.04, 12.5)\n\nmap\n```\n\n::: {.cell-output-display}\n\n```{=html}\n
\n\n```\n\n:::\n:::\n\nLet's put this map in a `bslib::card()` component with a proper title as well. We'll ad a title to the card with `bslib::card_header()`.\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmap_card <- card(\n card_header(\"Vehicle-Pedestrian Incidents for Chattanooga, TN (2018-2023)\"),\n map\n)\n\nmap_card\n```\n\n::: {.cell-output-display}\n\n```{=html}\n
\n
Vehicle-Pedestrian Incidents for Chattanooga, TN (2018-2023)
\n
\n
\n\n
\n\n
\n```\n\n:::\n:::\n\n\n\n## Putting the UI together\n\nCreate an empty page with `bslib::page_fillable()`. We can add all of our elements directly to this page.\n\n\n::: {.cell}\n\n```{.r .cell-code}\npage_fillable(\n theme = theme_bootswatch(\"darkly\"),\n map_card, stats, plot_tab\n)\n```\n\n::: {.cell-output-display}\n\n```{=html}\n\n
\n
Vehicle-Pedestrian Incidents for Chattanooga, TN (2018-2023)
\n
\n
\n\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Number of Incidents

\n

631

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Total Fatalities

\n

40

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n

Involved Medical Transport

\n

381

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Involved Drugs or Alcohol

\n

36

\n
\n
\n
\n\n
\n
\n
\n
\n
\nPlots\n\n
\n
\n
\n
\n
Vehicle-Pedestrian Incidents by Year
\n
\n\n
\n
\n
\n
\n
Vehicle Pedestrian Incidents by Posted Speed Limit
\n
\n\n
\n
\n
\n\n
\n\n```\n\n:::\n:::\n\nBut they are all squished together and it isnt much of a dashboard. We can use the `bslib::layout_columns()` function to begin to arrange this a bit more. Let's first get our right hand side of the dashboard arranged into its own layout so that the statistics sit above the plots. \nWe'll set the `col_widths = 12` so that each component takes the full width. \n\n\n::: {.cell}\n\n```{.r .cell-code}\nrhs_col <- layout_columns(\n stats,\n plot_tab,\n col_widths = 12\n)\n\nrhs_col\n```\n\n::: {.cell-output-display}\n\n```{=html}\n
\n
\n
\n
\n
\n
\n
\n
\n
\n

Number of Incidents

\n

631

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Total Fatalities

\n

40

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n

Involved Medical Transport

\n

381

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Involved Drugs or Alcohol

\n

36

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\nPlots\n\n
\n
\n
\n
\n
Vehicle-Pedestrian Incidents by Year
\n
\n\n
\n
\n
\n
\n
Vehicle Pedestrian Incidents by Posted Speed Limit
\n
\n\n
\n
\n
\n\n
\n
\n
\n```\n\n:::\n:::\n\nNow that we have the right hand side sorted out, let's create another `layout_columns()` where the map takes up 2/3 of the screen and the right hand column takes up the rest of the space. \n\n\n::: {.cell}\n\n```{.r .cell-code}\ndash_content <- layout_columns(\n map_card,\n rhs_col,\n col_widths = c(8, 4)\n)\n\ndash_content\n```\n\n::: {.cell-output-display}\n\n```{=html}\n
\n
\n
\n
Vehicle-Pedestrian Incidents for Chattanooga, TN (2018-2023)
\n
\n
\n\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n

Number of Incidents

\n

631

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Total Fatalities

\n

40

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n

Involved Medical Transport

\n

381

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Involved Drugs or Alcohol

\n

36

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\nPlots\n\n
\n
\n
\n
\n
Vehicle-Pedestrian Incidents by Year
\n
\n\n
\n
\n
\n
\n
Vehicle Pedestrian Incidents by Posted Speed Limit
\n
\n\n
\n
\n
\n\n
\n
\n
\n
\n
\n```\n\n:::\n:::\n\n\nNow we can put this in our `page_filable()`\n\n\n::: {.cell}\n\n```{.r .cell-code}\npage_fillable(dash_content)\n```\n\n::: {.cell-output-display}\n\n```{=html}\n\n
\n
\n
\n
Vehicle-Pedestrian Incidents for Chattanooga, TN (2018-2023)
\n
\n
\n\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n

Number of Incidents

\n

631

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Total Fatalities

\n

40

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n

Involved Medical Transport

\n

381

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Involved Drugs or Alcohol

\n

36

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\nPlots\n\n
\n
\n
\n
\n
Vehicle-Pedestrian Incidents by Year
\n
\n\n
\n
\n
\n
\n
Vehicle Pedestrian Incidents by Posted Speed Limit
\n
\n\n
\n
\n
\n\n
\n
\n
\n
\n
\n\n```\n\n:::\n:::\n", + "markdown": "---\ntitle: \"Dashboard using ArcGIS Hosted Data\"\nsubtitle: \"Building an interactive dashboard with {arcgis}\"\nfreeze: true\nresources: \n - html/*\n---\n\n\nIn this tutorial we will be recreating a dashboard that utilizes the data from the [City of Chattanooga Open Data Hub](https://www.chattadata.org/Public-Safety/Pedestrian-Accidents/8piy-9u9f). In the below LinkedIn post by [Charlie Mix](https://www.linkedin.com/in/charlie-mix/), they use this data to create an ArcGIS Dashboard. \n\n\n\n[Original LinkedIn Post](https://www.linkedin.com/posts/charlie-mix_arcgisdashboard-gis-activity-7135693623307767808-sbRW?utm_source=share&utm_medium=member_desktop)\n\nThe data is provided as a [Feature Service](https://services.arcgis.com/UnTXoPXBYERF0OH6/arcgis/rest/services/Vehicle_Pedestrian_Incidents/FeatureServer) by Charlie Mix, which we will use to create a lightweight interactive dashboard in R using `{arcgis}` and `{bslib}`.\n\nThe dashboard that we are going to create can be [viewed live here](https://r.esri.com/traffic-incidents-dashboard/index.html).\n\n## The Packages\n\n\nThere are 4 components to this dashboard that we will want to recreate. These are the two plots, the statistics, and the map. \n\n\nWe're going to use 9 packages to make this happen.\n\n::: {.cell}\n\n```{.r .cell-code}\n# knitr::opts_chunk$set(eval = FALSE)\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(sf)\nlibrary(bslib)\n```\n\n::: {.cell-output .cell-output-stderr}\n\n```\nWarning: package 'bslib' was built under R version 4.3.1\n```\n\n\n:::\n\n```{.r .cell-code}\nlibrary(dplyr)\nlibrary(arcgis)\nlibrary(plotly)\nlibrary(bsicons)\nlibrary(ggplot2)\nlibrary(leaflet)\n\ntheme_set(theme_minimal())\n```\n:::\n\n\n\n## Reading data from ArcGIS Online\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# open the feature server\ncrash_server <- arc_open(\"https://services.arcgis.com/UnTXoPXBYERF0OH6/arcgis/rest/services/Vehicle_Pedestrian_Incidents/FeatureServer\")\n\ncrash_server\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n>\nCRS: 32136\nCapabilities: Query\n 1: Vehicle Pedestrian Incidents (esriGeometryPoint)\n 2: Vehicle Pedestrian Incidents OptimizedHotSpotAnalysis (esriGeometryPolygon)\n```\n\n\n:::\n\n```{.r .cell-code}\n# fetch individual layers\n(incidents <- get_layer(crash_server, 1))\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n>\nName: Vehicle Pedestrian Incidents\nGeometry Type: esriGeometryPoint\nCRS: 32136\nCapabilities: Query\n```\n\n\n:::\n\n```{.r .cell-code}\n(hotspots <- get_layer(crash_server, 2))\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n>\nName: Vehicle Pedestrian Incidents OptimizedHotSpotAnalysis\nGeometry Type: esriGeometryPolygon\nCRS: 32136\nCapabilities: Query\n```\n\n\n:::\n\n```{.r .cell-code}\n# bring them into memory as sf objects\ninci_sf <- arc_select(incidents)\n```\n\n::: {.cell-output .cell-output-stderr}\n\n```\nRegistered S3 method overwritten by 'jsonify':\n method from \n print.json jsonlite\n```\n\n\n:::\n\n```{.r .cell-code}\nhs_sf <- arc_select(hotspots)\n```\n:::\n\n\n:::{.panel-tabset}\n\n### Hot Spot Analysis\n\n\n::: {.cell}\n\n```{.r .cell-code}\nglimpse(hs_sf)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\nRows: 369\nColumns: 10\n$ OBJECTID 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1…\n$ SOURCE_ID 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1…\n$ JOIN_COUNT 2, 1, 1, 1, 1, 2, 1, 6, 1, 3, 1, 1, 1, 3, 1, 3, 1, 2, 1,…\n$ GiZScore -0.40186687, -0.40186687, -0.40186687, -0.61763312, 0.76…\n$ GiPValue 0.6877820, 0.6877820, 0.6877820, 0.5368172, 0.4431177, 0…\n$ NNeighbors 3, 3, 3, 2, 10, 14, 14, 14, 7, 6, 21, 13, 6, 22, 24, 23,…\n$ Gi_Bin 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…\n$ Shape__Area 115843.3, 115848.0, 115857.5, 115909.8, 115924.1, 115933…\n$ Shape__Length 1266.954, 1266.979, 1267.031, 1267.318, 1267.396, 1267.4…\n$ geometry MULTIPOLYGON (((668610.5 95..., MULTIPOLYGO…\n```\n\n\n:::\n:::\n\n\n### Incidents\n\n\n::: {.cell}\n\n```{.r .cell-code}\nglimpse(inci_sf)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\nRows: 631\nColumns: 32\n$ OBJECTID 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,…\n$ Incident_Number \"23-008820\", \"22-130607\", \"22-108023\", \"23…\n$ Incident_Date 2023-01-25 18:00:00, 2022-12-03 18:02:00,…\n$ Time_Num 18.0, 18.0, 17.5, 1.5, 12.5, 20.5, 18.5, 9…\n$ Street \"E 11th St\", \"2000 S Kelley St\", \"Dodds Av…\n$ Alt_Street NA, NA, NA, NA, NA, \"US-11\", NA, NA, NA, \"…\n$ City \"Chattanooga\", \"Chattanooga\", \"Chattanooga…\n$ County \"Hamilton\", \"Hamilton\", \"Hamilton\", \"Hamil…\n$ Intersection \"Market St\", \"E 23rd Street\", \"E 41st St\",…\n$ Mile_Post NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…\n$ Accident_Type \"Possible Injury\", \"Property Damage Under\"…\n$ Collision_Type \"Not Collision with Motor Vehicle in Trans…\n$ Hit_and_Run \"No\", \"No\", \"No\", \"No\", \"No\", \"No\", \"No\", …\n$ Involved_Fatal_Injury \"No\", \"No\", \"No\", \"No\", \"No\", \"No\", \"No\", …\n$ Involved_Medical_Transport \"No\", \"No\", \"Yes\", \"Yes\", \"Yes\", \"Yes\", \"N…\n$ Involved_Placarded_Truck \"No\", \"No\", \"No\", \"No\", \"No\", \"No\", \"No\", …\n$ Posted_Speed 25, 20, 40, 30, 45, 45, 15, NA, 35, 45, 40…\n$ Total_Vehicles_Involved 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …\n$ Weather_Code \"Clear\", \"Clear\", \"Clear\", \"Clear\", \"Clear…\n$ Pedestrian_Involved \"Yes\", \"Yes\", \"Yes\", \"Yes\", \"Yes\", \"Yes\", …\n$ Bicycle_Involved \"No\", \"No\", \"No\", \"No\", \"No\", \"No\", \"No\", …\n$ Drug_Involved NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…\n$ Alcohol_Involved NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…\n$ Light_Condition \"Dark - Lighted\", \"Dark - Lighted\", \"Dayli…\n$ Driver_One_Safety_Equipment \"Unknown\", \"Unknown\", \"Unknown\", \"Unknown\"…\n$ Driver_One_Zip \"37411\", \"37403\", \"37421\", \"37421\", \"37404…\n$ Driver_Two_Safety_Equipment \"Shoulder and Lap Belt Used\", \"Shoulder an…\n$ Driver_Two_Zip \"30755\", \"37406\", \"37407\", \"37341\", \"32148…\n$ Latitude 35.04283, 35.01957, 34.99520, 35.08057, 35…\n$ Longitude -85.31865, -85.27885, -85.28440, -85.26217…\n$ Location_WKT \"POINT (-85.318653 35.0428324)\", \"POINT (-…\n$ geometry POINT (662169.1 78935.9), POINT (665…\n```\n\n\n:::\n:::\n\n\n:::\n\n## Creating the plots\n\n- use a combination of ggplot2 and plotly\n- ggplot2 creates the static plot\n- plotly makes it interactive\n\n\n\n::: {.cell layout-ncol=\"2\"}\n\n```{.r .cell-code}\nannual_counts <- inci_sf |>\n st_drop_geometry() |>\n mutate(year = lubridate::year(Incident_Date)) |>\n group_by(year) |>\n count() |>\n ungroup()\n\ngg_annual <- ggplot(annual_counts, aes(year, n)) +\n geom_line() +\n geom_point(size = 3) +\n labs(\n x = \"Year\",\n y = \"Incidents\"\n )\n\nspeed_counts <- inci_sf |>\n st_drop_geometry() |>\n count(Posted_Speed) |>\n filter(!is.na(Posted_Speed))\n\ngg_speed <- ggplot(speed_counts, aes(Posted_Speed, n)) +\n geom_col() +\n labs(\n x = \"Posted Speed Limit (miles per hour)\",\n y = \"Incidents\"\n )\n\ngg_annual\n```\n\n::: {.cell-output-display}\n![](index_files/figure-html/unnamed-chunk-6-1.png){width=672}\n:::\n\n```{.r .cell-code}\ngg_speed\n```\n\n::: {.cell-output-display}\n![](index_files/figure-html/unnamed-chunk-6-2.png){width=672}\n:::\n:::\n\n\nMake them interactive with plotly\n\n\n::: {.cell layout-ncol=\"2\"}\n\n```{.r .cell-code}\nggplotly(gg_annual)\n```\n\n::: {.cell-output-display}\n\n```{=html}\n
\n\n```\n\n:::\n\n```{.r .cell-code}\nggplotly(gg_speed)\n```\n\n::: {.cell-output-display}\n\n```{=html}\n
\n\n```\n\n:::\n:::\n\n\n\nWe will add these plotly widget directly into our dashboard as a tabset\n\n\n::: {.cell}\n\n```{.r .cell-code}\nplot_tab <- navset_card_tab(\n title = \"Plots\",\n nav_panel(\n \"By year\",\n card_title(\"Vehicle-Pedestrian Incidents by Year\"),\n ggplotly(gg_annual)\n ),\n nav_panel(\n \"By speed\",\n card_title(\"Vehicle Pedestrian Incidents by Posted Speed Limit\"),\n ggplotly(gg_speed)\n )\n)\n\nplot_tab\n```\n\n::: {.cell-output-display}\n\n```{=html}\n
\n
\nPlots\n\n
\n
\n
\n
\n
Vehicle-Pedestrian Incidents by Year
\n
\n\n
\n
\n
\n
\n
Vehicle Pedestrian Incidents by Posted Speed Limit
\n
\n\n
\n
\n
\n\n
\n```\n\n:::\n:::\n\n\n\n## Statistic value boxes\n\nWe want to calculate the statistics and present them in a value box. These are fairly simple statistics that we can calculate from the\n\n:::{.panel-tabset}\n\n### Base R\n\n\n::: {.cell}\n\n```{.r .cell-code}\nn_incidents <- nrow(inci_sf)\n\nn_medical_transit <- table(inci_sf$Involved_Medical_Transport)[\"Yes\"]\n\nn_fatalities <- table(inci_sf$Involved_Fatal_Injury)[[\"Yes\"]]\n\nn_alc_drug <- sum(\n inci_sf$Drug_Involved == \"Yes\" | inci_sf$Alcohol_Involved == \"Yes\", \n na.rm = TRUE\n)\n```\n:::\n\n\n### dplyr\n\n\n::: {.cell}\n\n```{.r .cell-code}\nn_incidents <- count(inci_sf) |> \n pull(n)\n\nn_medical_transit <- inci_sf |> \n count(Involved_Medical_Transport) |> \n filter(Involved_Medical_Transport == \"Yes\") |> \n pull(n)\n\nn_fatalities <- inci_sf |> \n count(Involved_Fatal_Injury) |> \n filter(Involved_Fatal_Injury == \"Yes\") |> \n pull(n)\n\nn_alc_drug <- inci_sf |> \n filter(Drug_Involved == \"Yes\" | Alcohol_Involved == \"Yes\") |> \n count() |> \n pull(n)\n```\n:::\n\n\n:::\n\n\nWe can pass these into `bslib::value_box()` to create nice looking cards. \n\n\n::: {.cell}\n\n```{.r .cell-code}\nvalue_box(\"Number of Incidents\", n_incidents)\n```\n\n::: {.cell-output-display}\n\n```{=html}\n
\n
\n
\n

Number of Incidents

\n

631

\n
\n
\n\n
\n```\n\n:::\n:::\n\nThe `showcase` argument lets us add text or images that are emphasized in the value box. Let's use bootstrap icons to add a bit of pizazz. \n\n\n::: {.cell}\n\n```{.r .cell-code}\nvalue_box(\n \"Number of Incidents\",\n n_incidents,\n showcase = bs_icon(\"person\")\n)\n```\n\n::: {.cell-output-display}\n\n```{=html}\n
\n
\n
\n
\n
\n

Number of Incidents

\n

631

\n
\n
\n
\n\n
\n```\n\n:::\n:::\n\nLet's create a card for each of these statistics and store them in their own variable. \n\n\n::: {.cell}\n\n```{.r .cell-code}\ninci_card <- value_box(\n \"Number of Incidents\",\n n_incidents,\n showcase = bs_icon(\"person\")\n)\n\nfatalities_card <- value_box(\n \"Total Fatalities\",\n n_fatalities,\n showcase = bs_icon(\"heartbreak\")\n)\n\nmedical_card <- value_box(\n \"Involved Medical Transport\",\n n_medical_transit,\n showcase = bs_icon(\"heart-pulse\")\n)\n\ndrugs_card <- value_box(\n \"Involved Drugs or Alcohol\",\n n_alc_drug,\n showcase = bs_icon(\"capsule\")\n)\n```\n:::\n\n\nLet's build out a component of our dashboard using these cards. We'll create a grid of these 4 using `layout_columns`. This will arrange bslib components into columns for us. \n\n\n::: {.cell}\n\n```{.r .cell-code}\nlayout_columns(\n inci_card, \n fatalities_card,\n medical_card, \n drugs_card\n)\n```\n\n::: {.cell-output-display}\n\n```{=html}\n
\n
\n
\n
\n
\n
\n
\n

Number of Incidents

\n

631

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Total Fatalities

\n

40

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n

Involved Medical Transport

\n

381

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Involved Drugs or Alcohol

\n

36

\n
\n
\n
\n\n
\n
\n
\n```\n\n:::\n:::\n\nBy default this will put each item in their own column. But we can specify the width of each element in grid units. In web development, user interfaces are often partitioned into grid units that are broken into twelve units. So if we want two value cards per row, we need to specify the column widths to be 6.\n\n\n::: {.cell}\n\n```{.r .cell-code}\nstats <- layout_columns(\n inci_card, \n fatalities_card,\n medical_card, \n drugs_card,\n col_widths = 6\n)\n\nstats\n```\n\n::: {.cell-output-display}\n\n```{=html}\n
\n
\n
\n
\n
\n
\n
\n

Number of Incidents

\n

631

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Total Fatalities

\n

40

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n

Involved Medical Transport

\n

381

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Involved Drugs or Alcohol

\n

36

\n
\n
\n
\n\n
\n
\n
\n```\n\n:::\n:::\n\n\n## Creating the map\n\n\n::: {.cell}\n\n```{.r .cell-code}\nhexes <- hs_sf |>\n transmute(\n classification = case_when(\n Gi_Bin == 0 ~ \"Not Significant\",\n Gi_Bin == 1 ~ \"Hot Spot with 90% Confidence\",\n Gi_Bin == 2 ~ \"Hot Spot with 95% Confidence\",\n Gi_Bin == 3 ~ \"Hot Spot with 99% Confidence\"\n )\n ) |>\n st_transform(4326)\n\n# create labels vector to pass to leaflet\ngi_labels <- c(\n \"Not Significant\",\n \"Hot Spot with 90% Confidence\",\n \"Hot Spot with 95% Confidence\",\n \"Hot Spot with 99% Confidence\"\n)\n\npal <- colorFactor(\n palette = c(\"#c6c6c3\", \"#c8976e\", \"#be6448\", \"#af3129\"),\n levels = gi_labels\n)\n\nmap <- leaflet() |>\n addProviderTiles(\"Esri.WorldGrayCanvas\") |>\n addPolygons(\n data = hexes,\n fillColor = ~pal(classification),\n color = \"#c6c6c3\",\n weight = 1,\n fillOpacity = 0.8\n ) |>\n addLegend(\n pal = pal,\n values = gi_labels,\n opacity = 1,\n title = \"Hot Spot Classification\"\n ) |>\n setView(-85.3, 35.04, 12.5)\n\nmap\n```\n\n::: {.cell-output-display}\n\n```{=html}\n
\n\n```\n\n:::\n:::\n\nLet's put this map in a `bslib::card()` component with a proper title as well. We'll ad a title to the card with `bslib::card_header()`.\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmap_card <- card(\n card_header(\"Vehicle-Pedestrian Incidents for Chattanooga, TN (2018-2023)\"),\n map\n)\n\nmap_card\n```\n\n::: {.cell-output-display}\n\n```{=html}\n
\n
Vehicle-Pedestrian Incidents for Chattanooga, TN (2018-2023)
\n
\n
\n\n
\n\n
\n```\n\n:::\n:::\n\n\n\n## Putting the UI together\n\nCreate an empty page with `bslib::page_fillable()`. We can add all of our elements directly to this page.\n\n\n::: {.cell}\n\n```{.r .cell-code}\npage_fillable(\n theme = theme_bootswatch(\"darkly\"),\n map_card, stats, plot_tab\n)\n```\n\n::: {.cell-output-display}\n\n```{=html}\n\n
\n
Vehicle-Pedestrian Incidents for Chattanooga, TN (2018-2023)
\n
\n
\n\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Number of Incidents

\n

631

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Total Fatalities

\n

40

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n

Involved Medical Transport

\n

381

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Involved Drugs or Alcohol

\n

36

\n
\n
\n
\n\n
\n
\n
\n
\n
\nPlots\n\n
\n
\n
\n
\n
Vehicle-Pedestrian Incidents by Year
\n
\n\n
\n
\n
\n
\n
Vehicle Pedestrian Incidents by Posted Speed Limit
\n
\n\n
\n
\n
\n\n
\n\n```\n\n:::\n:::\n\nBut they are all squished together and it isnt much of a dashboard. We can use the `bslib::layout_columns()` function to begin to arrange this a bit more. Let's first get our right hand side of the dashboard arranged into its own layout so that the statistics sit above the plots. \nWe'll set the `col_widths = 12` so that each component takes the full width. \n\n\n::: {.cell}\n\n```{.r .cell-code}\nrhs_col <- layout_columns(\n stats,\n plot_tab,\n col_widths = 12\n)\n\nrhs_col\n```\n\n::: {.cell-output-display}\n\n```{=html}\n
\n
\n
\n
\n
\n
\n
\n
\n
\n

Number of Incidents

\n

631

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Total Fatalities

\n

40

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n

Involved Medical Transport

\n

381

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Involved Drugs or Alcohol

\n

36

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\nPlots\n\n
\n
\n
\n
\n
Vehicle-Pedestrian Incidents by Year
\n
\n\n
\n
\n
\n
\n
Vehicle Pedestrian Incidents by Posted Speed Limit
\n
\n\n
\n
\n
\n\n
\n
\n
\n```\n\n:::\n:::\n\nNow that we have the right hand side sorted out, let's create another `layout_columns()` where the map takes up 2/3 of the screen and the right hand column takes up the rest of the space. \n\n\n::: {.cell}\n\n```{.r .cell-code}\ndash_content <- layout_columns(\n map_card,\n rhs_col,\n col_widths = c(8, 4)\n)\n\ndash_content\n```\n\n::: {.cell-output-display}\n\n```{=html}\n
\n
\n
\n
Vehicle-Pedestrian Incidents for Chattanooga, TN (2018-2023)
\n
\n
\n\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n

Number of Incidents

\n

631

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Total Fatalities

\n

40

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n

Involved Medical Transport

\n

381

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Involved Drugs or Alcohol

\n

36

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\nPlots\n\n
\n
\n
\n
\n
Vehicle-Pedestrian Incidents by Year
\n
\n\n
\n
\n
\n
\n
Vehicle Pedestrian Incidents by Posted Speed Limit
\n
\n\n
\n
\n
\n\n
\n
\n
\n
\n
\n```\n\n:::\n:::\n\n\nNow we can put this in our `page_filable()`\n\n\n::: {.cell}\n\n```{.r .cell-code}\npage_fillable(dash_content)\n```\n\n::: {.cell-output-display}\n\n```{=html}\n\n
\n
\n
\n
Vehicle-Pedestrian Incidents for Chattanooga, TN (2018-2023)
\n
\n
\n\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n

Number of Incidents

\n

631

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Total Fatalities

\n

40

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n

Involved Medical Transport

\n

381

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n

Involved Drugs or Alcohol

\n

36

\n
\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\nPlots\n\n
\n
\n
\n
\n
Vehicle-Pedestrian Incidents by Year
\n
\n\n
\n
\n
\n
\n
Vehicle Pedestrian Incidents by Posted Speed Limit
\n
\n\n
\n
\n
\n\n
\n
\n
\n
\n
\n\n```\n\n:::\n:::\n", "supporting": [ "index_files" ], diff --git a/location-services/tutorials/shiny-dash/index.qmd b/location-services/tutorials/shiny-dash/index.qmd index 5ffe63a..5cc88e8 100644 --- a/location-services/tutorials/shiny-dash/index.qmd +++ b/location-services/tutorials/shiny-dash/index.qmd @@ -3,7 +3,7 @@ title: "Dashboard using ArcGIS Hosted Data" subtitle: "Building an interactive dashboard with {arcgis}" freeze: true resources: - - html/lib + - html/* --- In this tutorial we will be recreating a dashboard that utilizes the data from the [City of Chattanooga Open Data Hub](https://www.chattadata.org/Public-Safety/Pedestrian-Accidents/8piy-9u9f). In the below LinkedIn post by [Charlie Mix](https://www.linkedin.com/in/charlie-mix/), they use this data to create an ArcGIS Dashboard.