Dynamic Analysis of Severe Weather Events in USA

Eric Lim B G
22 February 2015

Coursera: Developing Data Products (Rpres)

Background

Storms and other severe weather events cause both public health and economic problems for communities and municipalities across the United States

A shiny application has been developed to help visualise this events using data from the U.S. National Oceanic and Atmospheric Administration's (NOAA) storm database

The shiny application is composed of:

  1. A Dashboard with a dynamic selections and charting interface for that a user to explore the NOAA data
  2. An About that describes the application and provides references to other related information
  3. A Help guide that serve to let user get started with using this shiny application

Underlying Dataset

A subset of NOAA's storm database were extracted for the shiny application. Its structure is as shown below:

data <- read.csv('data/usstormdata.csv')
str(data)
'data.frame':   17614 obs. of  7 variables:
 $ YEAR      : int  1950 1951 1952 1953 1954 1955 1955 1955 1956 1956 ...
 $ STATE     : Factor w/ 50 levels "alabama","alaska",..: 1 1 1 1 1 1 1 1 1 1 ...
 $ EVTYPE    : Factor w/ 18 levels "AVALANCHE","BLIZZARD / WINTER STORM / WEATHER",..: 15 15 15 15 15 10 14 15 10 14 ...
 $ FATALITIES: int  0 0 6 16 0 0 0 5 0 0 ...
 $ INJURIES  : int  15 13 116 248 36 0 0 27 0 0 ...
 $ PROPDMG   : num  0.0275 0.035 5.4525 3.07 0.6075 ...
 $ CROPDMG   : num  0 0 0 0 0 0 0 0 0 0 ...

Shiny UI & Server Calculation

The main interaction between the shiny UI and Server is in filtering the underlying plot data (see below)

filterdata<-reactive({
    replace_na<-function(x) ifelse(is.na(x),0,x)
    round_2<-function(x) round(x,2)
    aggregated<-rawdata%>% 
        filter(YEAR>=input$period[1],
               YEAR<=input$period[2],
               EVTYPE %in% input$evtypes)%>%
        group_by(STATE)%>%
        summarise_each(funs(sum),
                       FATALITIES:CROPDMG)%>%
        mutate_each(funs(replace_na),
                    FATALITIES:CROPDMG)%>%
        mutate_each(funs(round_2),PROPDMG,CROPDMG)
    })

Shiny Geospatial Plot

Filtered data drived from interactions between the shiny UI and Server is plotted in a geospatial chart (shown below) plot of chunk unnamed-chunk-3