I created a bar chart that shows the miles traveled divided by trip purpose. The data comes from The National Household Travel Survey from 2017. The survey is conducted by the U.S Department of Transportation Federal Highway Administration.
Here is the code for my app:
ui <- fluidPage( plotOutput(“plot”, click = “plot_click”), tableOutput(“data”) ) server <- function(input, output, session) { output$plot <- renderPlot({ ggplot(vmt_purpose, aes(x=Trip.purpose.summary,y=Sum..Millions.))+geom_col()+coord_flip()+ labs(title = “Vehicle Miles Traveled by Purpose (2017)”, y= “Sum of Miles Traveled (In Millions)”, x= “Trip Purpose”)
}, res = 96)
output\(data <- renderTable({ req(vmt_purpose, input\)plot_click)
}) } shinyApp(ui, server)