load("rb_cs_usmap.rda")
# filter out NA in year completed
rb <- rb_cs_usmap[!is.na(rb_cs_usmap$year_completed), ]
min(rb$year_completed)
# min is 1791
max(rb$year_completed)
# max is 2023
# let's make the plot function
rbPlot <- function(years) {
rb_years <- rb[rb$year_completed >= years[1] & rb$year_completed <= years[2] , ]
plot_usmap(regions = "states") +
geom_sf(data = rb_years, aes(color = year_completed)) +
scale_color_continuous(low = "green", high = "red", name = "Year Completed")
}
ui <- fluidPage(
titlePanel("US Roundabouts by Year Completed"),
sidebarLayout(
sidebarPanel(
sliderInput("years", label="Years", min=1791, max=2023, value=c(1900, 2000))
),
mainPanel(
plotOutput("yearPlot")
)
)
)
server <- function(input, output, session) {
output$yearPlot <- renderPlot({rbPlot(input$years)})
}
shinyApp(ui = ui, server = server)US Roundabout Construction Explorere Tool
A basic interactive tool to explore US Roundabout construction over time
Introduction
This is a simple shiny app that allows the user to input a range of years and see the roundabouts that were constructed in the US during those years
The App
Methods
This is the dataset that was used for this app, from Tidy Tuesdays
It has been cleaned up and the coordinates have been converted to work with the USMAP function.
This is the code for the shiny app: