UK Annual Driver Deaths: An Interactive Plotting App

Matt Heimdahl
11-10-2019

Introduction

This Shiny app allows the user to select an annual date range between 1969 and 1984 to see annual trends in driver casualties (deaths and serious injuries) in Great Britain.

Time Range Widget

The user can adjust the time period shown in the plot by using the slider widget:

<!–html_preserve–>

<!–/html_preserve–>

Line Plot

Once the years in the slider widget have been selected, a line plot will populate showing annual trends in driver casualties in Great Britain for the years selected.

<!–html_preserve–>

<!–/html_preserve–>

Code for user interface object

# Define UI for application that draws a histogram
shinyUI(fluidPage(
    titlePanel("Trends in UK Driver Deaths"),     # Application title
        # Sidebar with a slider input for date range (years)
        sidebarPanel(
            sliderInput("Years",
                        "Date Range:",
                        min = 1969,
                        max = 1984,
                        value = c(min,max), sep = "", width = 2000)),
        # Show a line plot of UK road casualties
        mainPanel(
            plotOutput("linePlot"))))

<!–html_preserve–>

Trends in UK Driver Deaths

<!–/html_preserve–>