The most expensive and health damaging types of storms

SYNOPSIS

This analysis is focused on answering the questions:

  1. Across the United States, which types of events (as indicated in the EVTYPE variable) are most harmful with respect to population health?

  2. Across the United States, which types of events have the greatest economic consequences?

The idea is to use data from storms to answer this questions and use this for public policy. We will group economic and health consecuences by type of event to deduce which storms should we care most.

Some of the documentation can be found from the National Weather Service Storm Data Documentation and from the National Climatic Data Center Storm Events FAQ.

Data Processing

First we read the file

storms <- read.table("repdata-data-StormData.csv.bz2", header = T, sep = ",")

From the documentation and from the following thread we can see that our important variables are EVTYPE, FATALITIES, INJURIES, PROPDMG, PROPDMGEXP, CROPDMG & CROPDMGEXP.

names(storms)
##  [1] "STATE__"    "BGN_DATE"   "BGN_TIME"   "TIME_ZONE"  "COUNTY"    
##  [6] "COUNTYNAME" "STATE"      "EVTYPE"     "BGN_RANGE"  "BGN_AZI"   
## [11] "BGN_LOCATI" "END_DATE"   "END_TIME"   "COUNTY_END" "COUNTYENDN"
## [16] "END_RANGE"  "END_AZI"    "END_LOCATI" "LENGTH"     "WIDTH"     
## [21] "F"          "MAG"        "FATALITIES" "INJURIES"   "PROPDMG"   
## [26] "PROPDMGEXP" "CROPDMG"    "CROPDMGEXP" "WFO"        "STATEOFFIC"
## [31] "ZONENAMES"  "LATITUDE"   "LONGITUDE"  "LATITUDE_E" "LONGITUDE_"
## [36] "REMARKS"    "REFNUM"
tidyStorms <- storms[, c(8, seq(23, 28))]

Analysis

Health Harm

Fatalities

To analyze fatalities we just need to look at the variable FATALITIES. So we will sum all fatalities for each event type (EVTYPE) and look at the top 10 most harmful of event types.

library(plyr)
library(ggplot2)

fatalities <- ddply(tidyStorms, "EVTYPE", summarise, totalFatalities = sum(FATALITIES, 
    na.rm = T))
fatalities <- fatalities[order(fatalities$totalFatalities, decreasing = T), 
    ]
fatalities$EVTYPE <- factor(fatalities$EVTYPE, as.character(fatalities$EVTYPE))
fatalities <- fatalities[1:5, ]
fatalities
##             EVTYPE totalFatalities
## 834        TORNADO            5633
## 130 EXCESSIVE HEAT            1903
## 153    FLASH FLOOD             978
## 275           HEAT             937
## 464      LIGHTNING             816

Injuries

For analyzing injuries we do the same but with the variable INJURIES instead of fatalities.

injuries <- ddply(tidyStorms, "EVTYPE", summarise, totalInjuries = sum(INJURIES, 
    na.rm = T))
injuries <- injuries[order(injuries$totalInjuries, decreasing = T), ]
injuries$EVTYPE <- factor(injuries$EVTYPE, as.character(injuries$EVTYPE))
injuries <- injuries[1:5, ]
injuries
##             EVTYPE totalInjuries
## 834        TORNADO         91346
## 856      TSTM WIND          6957
## 170          FLOOD          6789
## 130 EXCESSIVE HEAT          6525
## 464      LIGHTNING          5230

Economic Damage

Now we look at the data for property and crop damage. This is a little trickier since we have 2 variables for each type (one for the amount of damage and the other for the units in which the damage is measured). We will analyze the data and based on some threads decide what to do about it.

Property Damage

First we look at the values that PROPDMGEXP takes. This is important because the documentation indicates that K, k, m, M and B are values indicating thousands, millions or billions of dollars, but we might have other values.

table(tidyStorms$PROPDMGEXP)
## 
##             -      ?      +      0      1      2      3      4      5 
## 465934      1      8      5    216     25     13      4      4     28 
##      6      7      8      B      h      H      K      m      M 
##      4      5      1     40      1      6 424665      7  11330

We can see that we have some other values (?, +, -, “” and numeric values). Recall that we are looking for a result that helps us find the most harmful event types, so we just need to focus on damage of very high magnitude in terms of cost.

First we analyze the numeric values.

numericEXP <- subset(tidyStorms, PROPDMGEXP %in% seq(0, 8))
summary(numericEXP)
##                 EVTYPE      FATALITIES        INJURIES     
##  THUNDERSTORM WINDS:193   Min.   :0.0000   Min.   : 0.000  
##  HAIL              : 29   1st Qu.:0.0000   1st Qu.: 0.000  
##  LIGHTNING         : 22   Median :0.0000   Median : 0.000  
##  TORNADO           : 19   Mean   :0.0167   Mean   : 0.113  
##  FLASH FLOOD       : 14   3rd Qu.:0.0000   3rd Qu.: 0.000  
##  FLOOD/FLASH FLOOD :  3   Max.   :3.0000   Max.   :24.000  
##  (Other)           : 20                                    
##     PROPDMG        PROPDMGEXP     CROPDMG        CROPDMGEXP 
##  Min.   :  0.0   0      :216   Min.   :  0.0          :292  
##  1st Qu.:  1.0   5      : 28   1st Qu.:  0.0   K      :  6  
##  Median : 17.5   1      : 25   Median :  0.0   M      :  2  
##  Mean   : 25.0   2      : 13   Mean   :  2.2   ?      :  0  
##  3rd Qu.: 50.0   7      :  5   3rd Qu.:  0.0   0      :  0  
##  Max.   :150.0   3      :  4   Max.   :430.0   2      :  0  
##                  (Other):  9                   (Other):  0
table(numericEXP$PROPDMGEXP)
## 
##       -   ?   +   0   1   2   3   4   5   6   7   8   B   h   H   K   m 
##   0   0   0   0 216  25  13   4   4  28   4   5   1   0   0   0   0   0 
##   M 
##   0

It doesn't see to be really huge events in numericEXP (there are not many injuries or fatalities) and the threads from the course suggest the numeric values in PROPDMGEXP are exponents for the 10n multiplier of PROPDMG. But the table says we just have 1 values for 8 in PROPDMGEXP and 5 for 7. Lets look at this events and particularly at the remarks to check if it makes sense.

subset(storms, PROPDMGEXP %in% c("7", "8"))$REMARKS
## [1] The roof of the New Haven Police Department and radio tower suffered extensive damage.  Large trees were also blown down and uprooted in the Leslie and Gerald areas.                                                                                                                                              
## [2] Up to eight inches of rain in a three hour period caused the worst flash flood ever along the Meherrin River in the town of Severn. Between 15 and 20 residences were damaged significantly by the flood, with water window high in many of these homes. Damage also occurred at the local sewage treatment plant. 
## [3] Over 40 building suffered structural damage to them.  A few trees were knocked down.  A man was injured in Liberty Hill as he sought shelter in his camp trailer.  Eight power poles were blown down.                                                                                                              
## [4] Several homes and several hundered vehicle were damaged.                                                                                                                                                                                                                                                           
## [5] Several houses had windows broken and numerous cars were damaged.                                                                                                                                                                                                                                                  
## [6] A home was destroyed by a fire started by lightning.                                                                                                                                                                                                                                                               
## 436781 Levels:  -2 at Deer Park\n ... Zones 22 and 23 were added to the high wind warning of  January 26. Peak winds Sitka 55MPH, Cape Decision 58MPH, and Cape Spencer 64MPH.\n

Well, looking at the data it seems plausible to think that the numeric values in PROPDMGEXP are the exponents of the multiplier of PROPDMG.

Now we look at the events that have the symbols -, ? and +.

subset(storms, PROPDMGEXP %in% c("?", "-", "+"))$REMARKS
##  [1] Typical of this time of year is the seasonal breakup process across mainland Alaska.  Major rivers, which serve as transportation corridors around the state, undergo the change from ice covered roadways (even plowed by the state) to summer boat/barge traffic.  May 6th and 7th brought flooding to Bethel, on the Kuskokwim River.  Damage occurred to the seawall and caused Brown Slough to back up.  Areas along the waterfront and low areas bordering the slough were flooded, worst of which occurred along Alder Street, East Avenue, Fourth through Seventh Avenues, Main Street, and Settler Drive.  Several vehicles were nearly submerged and several people were rescued from homes that had flood water coming in.  Additionally, there were several oil spills from local tanks used to heat homes.  Other villages affected by breakup on the Kuskokwim River were (in order) Aniak (damaged roads and damaged dike), Akiak, Akiachak, Kwethluk (airport road damage, extensive boardwalk damage, and insulation damage to 13 homes), Oscarville (flooded sewage lagoon, flooded streets and boardwalk, and a few flooded structures), and then Napaskiak (flooded roads and the new runway was isolated, insulation damage to six homes).  Upper and Lower Kalskag were also affected by "minor" breakup flooding. Minor flooding was reported along the Yukon River at Pilot Station, Marshall, Emmonak (six houses), and Alakanuk (roads and other low lying areas). 
##  [2] Cold and strong high pressure (1040mbs) moved southeast to near Dawson, Canada.  Strong "gap" type winds continue from the Alaskan mainland into Prince William Sound.  Peak winds were 58 mph at Whittier and 63 mph at Valdez where oil tanker traffic was still held up in the Port of Valdez.  Middleton Island recorded 59 mph.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
##  [3] Russian River and small streams flooded roads and homes, numerous mudslides closing roads.  Trees and power lines downed.  A fishing boat in Crescent City was blown off a maintenance stand.  Wind gust of 69 mph in Mendocino with an unconfirmed gust of 113 mph.  Three large trees fell on a house in Garberville destroying it and killing a goldfish.  Two homes destroyed in Gualala by mudslide.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
##  [4] Hail was again the main feature from these late night thunderstorms.  One report of tree damage was received from Galva, Illinois, where 18-inch-diameter tree limbs were down.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
##  [5] Lake Tahoe-Truckee,,,,,,,,,Flooding Area, Central Sierra,,,,,,,,,Heavy Snow East Slopes, Extreme Western Nevada,,An unseasonably cold upper level low pressure system dropped south from West-Central Nevada,,the Gulf of Alaska and brought a variety of severe weather to the Northwest Nevada,Silver State.  Elevations above 7,000 feet in the Lake Tahoe-Truckee area and the east slopes of the central Sierra received 8 to 10 inches of snow.  Mountain top sensors around Lake Tahoe recorded wind gusts over 100 mph.  At lower elevations, wind gusts of 75 and 70 mph were reported at Gardnerville and Fallon, respectively.  The frontal system associated with this storm kicked off severe thunderstorms along its boundary.  One-half inch to three-quarters inch hail fell over Lovelock and Battle Mountain during these storms.  A funnel cloud was reported over Fallon, where one-half inch of rain fell in just over two hours.  Yerington received 0.77 inches of rain in a six-hour-period.  The winds at Fallon damaged the airport where the roof was ripped off a hanger.  Trees were uprooted across Churchill County and power lines were downed.  Numerous accidents were blamed on the bad weather.  The heavy rains caused urban and small stream flooding across west-central Nevada as several roads were washed out there and basements and yards were flooded.                                                                                          
##  [6] Nevada, West- ,,,,,,,,,,,,,,,Funnel Clouds Central Nevada,,,,,,,,,,High Winds East-Central Nevada,A strong cold front stretching from northeast Nevada into south-central Nevada triggered a tornado in the Silver Springs area.  The tornado was reported on the ground by the Nevada Office of Emergency Management at 1300 PDT.  It stayed on the ground for several hundred yards and then lifted again.  In its path three mobile homes were damaged, one was destroyed, power lines were downed and at least 12 homes were damaged.  Several trees were uprooted and fences downed.  A funnel cloud was also spotted in west Carson City moving towards Dayton.  Farther along the front, winds gusted to 61 mph at Ely where siding was blown off some houses and power lines were downed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
##  [7]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
##  [8]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
##  [9] The massive storm that produced high winds on the coast spread strong and damaging winds to most of Oregon as it moved northward offshore during the day of the 12th.  Two people were killed, and widespread damage occurred due to falling trees.  Power was out for over a day at many locations.  Highest reported wind gusts included 74 mph at Portland, with wind blowing out windows downtown, Beaverton and Canby 65 mph, Dallas 60 mph, Troutdale and Salem 58 mph, Cave Junction 64 mph, and Bend sustained 45 mph winds with trees blown down near LaPine. A Forest Grove woman died when a tree fell onto the car she was driving, and a Beavercreek woman died from head injuries when she was knocked down by a livestock gate she was opening that was caught by a strong wind gust. F51V, F53O.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
## [10] Power lines blown down in Darlington reported by Highway Patrol.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
## [11]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
## [12]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
## [13]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
## [14] Power lines and several trees were blown down.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
## 436781 Levels:  -2 at Deer Park\n ... Zones 22 and 23 were added to the high wind warning of  January 26. Peak winds Sitka 55MPH, Cape Decision 58MPH, and Cape Spencer 64MPH.\n

Here we see that it also doesn't seem to be a really huge event that could have a big damage in property.

Finally, we look at the blank (ie “”) value.

noEXP <- subset(tidyStorms, PROPDMGEXP == "")
summary(noEXP)
##                 EVTYPE         FATALITIES     INJURIES      PROPDMG  
##  HAIL              :196662   Min.   :  0   Min.   :  0   Min.   : 0  
##  TSTM WIND         :157095   1st Qu.:  0   1st Qu.:  0   1st Qu.: 0  
##  FLASH FLOOD       : 21319   Median :  0   Median :  0   Median : 0  
##  THUNDERSTORM WINDS:  8951   Mean   :  0   Mean   :  0   Mean   : 0  
##  TORNADO           :  8805   3rd Qu.:  0   3rd Qu.:  0   3rd Qu.: 0  
##  HEAVY SNOW        :  8695   Max.   :583   Max.   :437   Max.   :75  
##  (Other)           : 64407                                           
##    PROPDMGEXP        CROPDMG        CROPDMGEXP    
##         :465934   Min.   :  0.0          :461616  
##  -      :     0   1st Qu.:  0.0   K      :  3865  
##  ?      :     0   Median :  0.0   M      :   443  
##  +      :     0   Mean   :  0.5   B      :     4  
##  0      :     0   3rd Qu.:  0.0   0      :     3  
##  1      :     0   Max.   :990.0   ?      :     2  
##  (Other):     0                   (Other):     1

noExp has some events that could be very expensive ones. This can be seen from the fatalities, injuries and the CROPDMGEXP = “B” that we have in this dataset. Lets look carefully at this events.

subset(storms, PROPDMGEXP == "" & CROPDMGEXP == "B")$REMARKS
## [1] Hot, dry weather was a problem for Alabama throughout the month.  New record high temperatures were set in a number of cities with Critical Heat Alerts in effect for many days during the month.  Birmingham, for example, hit 100 degrees or higher on seven consecutive days from the 13th to the 19th as well as setting  seven new record high temperatures.  At least one county school system, Marshall County, delayed opening schools for one week because of the heat.  One of the industries hit hardest by the heat was agriculture.  Unfortunately, the effects of a hot period are sometimes not fully known until months later.  The poultry industry was hit hard along with a number of crops including tomatoes, cotton, peanuts, and cattle.  The $400 million crop damage is just an estimate.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
## [2] August precipitation was confined to widely scattered thunderstorm activity, which produced a wide variation of monthly rainfall amounts.  The highest of these was 9.23 inches at Bondurant in central Iowa (details on that below) to .29 inches at Dubuque for the 4th driest August on record at Dubuque.  Statewide rainfall distribution was highest over northwest and north central Iowa, and lowest over the south central counties.  The dry weather conditions combined with well above normal temperatures translated to the warmest month recorded in Iowa since July 1988 and the 4th warmest August of record.  For the summer as a whole, June through August of 1995 ranked 14th warmest in the 123 years of record.  The dry conditions resulted in deterioration of Iowas corn and soybean crops.  Yield losses were greatest over southern Iowa where plantings were delayed by excessive spring rainfall.  Reports indicate losses in the corn of between five and 25 bushels per acre with the greatest over the south.  Soybean loses were not that great and were generally 5% or less.  In dollars this translates to about $420 million in corn and $116 million in soybeans.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
## [3] A strong cold front pushed south across Iowa bringing with it one of the earliest freezes on record.  Coupled with the fact that crop maturation was behind schedule, significant freeze damage occurred.  Temperatures dipped to as low as 24° F. (-5° C.) over the northwest counties and to the freezing point over the southeast.  These temperatures were combined with a five to 10 knot wind and lasted for up to eight hours in the northwest and about three hours over the southeast.  The soybeans were hardest hit with approximately $30 million bushels lost.  The corn crop was not as badly damaged as drought from the previous month had already done significant damage to the crop.  In dollar amounts, damage to the soybeans was around $195 million, while the corn suffered about a $9 million loss.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
## [4] Drought conditions continued across north Texas as precipitation deficits increased.  This month, all of north Texas was classified in either extreme drought (D3) or exceptional drought (D4) as classified by the U.S. Drought Monitor.  Every county in north Texas was eligible for federal disaster relief due to the drought.  The weather continued to be unseasonable warm.  The average high temperature this January was 68.3 degrees, a full 14.2 degrees above normal.  This figure broke an 83-year-old record.  \n\nWildfires continued to be a major problem in January, with a burn ban in place in every county.  A quarter of a million acres burned across Texas in the first half of the month, more than during all of 2005.  The ongoing drought combined with strong winds and low humidities to create a volatile fire situation in Texas.  On New Year's Day, several devastating wildfires erupted across north Texas.  Forty homes were destroyed in Montague County as a 17-mile long fire burned between Ringgold and Nocona.  Another grass fire in Johnson County burned 13 buildings and charred 1,800 acres.  In Eastland County, a fire encompassing more than 35,000 acres forced the evacuations of several communities and destroyed the city of Kokomo.  Thirty-six buildings were lost in the fire.  Several firefighters and civilians suffered burns, smoke inhalation, and heat exhaustion due to the fires.\n\nHydrological and agricultural impacts worsened over the past month due to the lack of rainfall.  Most water reservoirs across north Texas were 60% to 85% of normal capacity.  Several lakes across the region were 10 to 15 feet below normal pool elevation.  The North Texas Municipal Water District implemented watering restrictions earlier than normal this year due to the lowering lake levels.  Watering restrictions were also in effect on a voluntary basis in some cities. \n\nThe Texas Cooperative Extension estimated agricultural losses for north Texas to be close to $1 billion in January.  Only half of the state's hay crop was fit for harvesting, and hay prices were three to four times their normal price.  Many other crops failed to grow at all.  Agricultural groups appealed for federal grants to aid the cattle industry.  One emergency measure considered by the federal government included providing cash to ranchers to offset high feed costs and losses due to the drought and wildfires. A drought summit was held in San Antonio to discuss the crisis. \n\nThe drought was also affecting wildlife in north Texas.  The Texas Department of Parks and Wildlife reported an overall decline in habitat conditions, and noted that the lack of green plants would affect the survival rate of certain animals.
## 436781 Levels:  -2 at Deer Park\n ... Zones 22 and 23 were added to the high wind warning of  January 26. Peak winds Sitka 55MPH, Cape Decision 58MPH, and Cape Spencer 64MPH.\n
subset(storms, PROPDMGEXP == "" & FATALITIES == 583)$REMARKS
## [1] An intense heat wave affected northern Illinois from Wednesday July 12 through Sunday July 16. The heat wave tied or broke several temperature records at Rockford and Chicago. But what set this heat wave apart from others was the extremely high humidities. Dew point temperatures peaked in the lower 80s late Wednesday the 12th and Thursday the 13th and were generally in the middle and upper 70s through the rest of the hot spell. The combined and cumulative effects of several days of high temperatures, high humidity, intense July sunshine (100% possible sunshine recorded at O'Hare Airport in Chicago July 13) and light winds took their toll. 583 people died as a result of the heat in Chicago and surrounding areas. Official temperatures at Chicago's O'Hare International Airport were 7/12; minimum 73 maximum 97 (tied record), 7/13 minimum 81 (record) maximum 104 (record), 7/14 minimum 83 (record), maximum 100 (tied record), 7/15 minimum 75, maximum 98, 7/16 minimum 74, maximum 93. The heat peaked on Thursday July 13. O'Hare had a high of 104 and a low of 81 for an average of 93, 20 degrees above normal. (The all-time record high for Chicago is 105.) The heat index peaked at 119 at 1300 and 1700. At Midway Airport the temperature hit 106. (Midway is not the official Chicago reporting station so the 106 did not become Chicago's official highest temperature.) The heat index at Midway reached 125 at 1400 when the temperature was 103 and the dew point was 79. What was really remarkable was that Meigs Field which sits on a small peninsula over the cool waters of Lake Michigan off the Chicago lakefront reached 103 degrees with a heat index of 115. Rockford had high temperatures of 97, 98, 97 and 94 on the 12 through 15th, respectively. The minimum of 75 on the 14th was a record. The heat index peaked at 125 at 1800 pm on the 13th when the temperature was 98 with a dew point of 83! Commonwealth Edison, which provides much of northern Illinois and virtually all of the Chicago metropolitan area with power, had record demands for electricity on the 12th through the 14th. Power output was 18,234, 19,151 and 19,201 megawatts, respectively. Transformers blew in the southwest suburbs near Joliet causing rolling power outages on the 13th and 14th. The north side of Chicago also lost power as did the northwest suburb of Cary. Draw bridges over the Chicago River had to be hosed down so they would operate and close properly. Several roads buckled from the heat. As many as 500 fire hydrants were opened in Chicago causing loss of water pressure. The city of Chicago used a record 1.8 billion gallons of water on the 13th. The city's water system has a capacity to pump 2 billion gallons a day. \nThere were over 580 fatalities attributed to the heat. Most of them occurred in the city of Chicago. Most of the deaths occurred two to three days following the peak of the heat wave. Many were elderly people living alone in homes or apartments with no air conditioning. Some had nailed windows shut and were afraid to go out because of crime in their neighborhoods. Emergency officials found people in homes with room temperatures of 120 degrees or higher. Here is a break down of fatalities by county; Lake County, 1 (Ingleside), Grundy County, 1 (Morris), Kane County, 7 (all in Aurora), Winnebago County, 5 (all in Rockford), Will County, 1 (Joliet), Cook, 568. The information from Cook County was provided by the Cook County Medical Examiners Office. 64 of the deaths occurred in suburban Cook County. 504 occurred in Chicago. The dates of the deaths are not known in all cases. Many of the examinations occurred in the days following the heat wave, more occurred later as funeral home and hospital records were checked. Heat was the primary cause of death in 75 of the cases and a secondary cause in the rest of the deaths. Information on morbidity is being compiled by the Cook County Department of Health. An estimate on number of injuries will be available later this year as an addition.  F78PH, F87PH, M43OU, F38PH, M56PH, M67PH, M68PH, M84PH, M81PH, F91PH, M58PH, M60PH, M42PH, M73PH, M57PH, M32PH, M86PH, M75PH, F64PH, M88PH, F70PH, M69PH, M86PH, F72PH, M76PH, F83PH, M74PH, F68PH, M68PH, F83PH, M86PH, F87PH, M58PH, M38PH, F74PH, M55PH, M57PH, F85PH, M03VE, M03VE, F77PH, M78PH, F87PH, M60PH, F41PH, F80PH, F75PH, M65PH, F46PH, F89PH, M64PH, F79PH, M59PH, M88PH, M47PH, F95PH, M81PH, F97PH, M85PH, F103PH, M86PH, F57PH, F29PH, F90PH, F87PH, F80PH, M60PH, M82PH, M75PH, F72PH, M40PH, M89PH, M45PH, F52PH, M80PH, M60PH, M??PH, M51PH, M58PH, M45PH, F91PH, M61PH, M41PH, M65PH, F91PH, M39PH, M56PH, F65PH, F94PH, F87PH, F91PH, M81PH, M45PH, M82PH, F42PH, M65PH, F80PH, M60PH, M74PH, M63PH, M84PH, F84PH, M80PH, M86PH, M59PH, F83PH, F79PH, M67PH, F71PH, F??PH, M87PH, F87PH, F84PH, F78PH, F90PH, F41PH, F79PH, F83PH, M73PH, M75PH, M77PH, F66PH, M80PH, M87PH, M53PH, F29PH,  F82PH, M67PH, F75PH, M90PH, M67PH, M66PH, F98PH, F95PH, M35PH, M62PH, F85PH, F85PH, M86PH, M72PH, M53PH, F89PH, M80PH, M77PH, M56PH, F55PH, F93PH, M71PH, F74PH, F42PH, M81PH, F77PH, F75PH, F81PH, M92PH, M76PH, F71PH, M56PH, F72PH, F83PH, M79PH, F98PH, F75PH, M55PH, F73PH, F79PH, F83PH, F94PH, M76PH, M58PH, F52PH, M44PH, F87PH, M66PH, M55PH, F86PH, F88PH, F80PH, F87PH, F91PH, F69PH, F74PH, M77PH, F84PH, M69PH, M48PH, F82PH, F41PH, M69PH, F84PH, M71PH, M83PH, M88PH, M74PH, M79PH, M64PH, F92PH, M67PH, M53PH, M95PH, F90PH, M84PH, M67PH, M60PH, F85PH, M66PH, M62PH, MPH71, M68PH, F78PH, M71PH, F84PH, F77PH, M63PH, F65PH, M45PH, M56PH, M76PH, M42PH, F85PH, F86PH, M55PH, M85PH, M78PH, F91PH, F69PH, F94PH, M40PH, M77PH, F81PH, F85PH, M70PH, M64PH, M84PH, F70PH, F70PH, M61PH, M80PH, M87PH, F76PH, M65PH, M47PH, M47PH, F69PH, M64PH, F86PH, M57PH, M74PH, M55PH, F78PH, M85PH, M51PH, M71PH, F72PH, F85PH, M60PH, M72PH, F92PH, F49PH, M46PH, F85PH, M64PH, F69PH, M87PH, F89PH, M70PH, F69PH, M67PH, M40PH, M86PH, F86PH, F84PH, M54PH, M78PH, F81PH, M48PH, M54PH, F80PH, M64PH, M79PH, M60PH, M80PH, F86PH, F93PH, F80PH, M71PH, M47PH, F89PH, F60PH, F88PH, M84PH, F81PH, F70PH, F86PH, F77PH, F75PH, F68PH, M85PH, F87PH, M55PH, M84PH, F83PH, M??PH, F71PH, M82PH, M64PH, F65PH, F72PH, M91PH, M66PH, M47PH, F89PH, F80PH, F77PH, F81PH, F80PH, F67PH, F84PH, M52PH, F79PH, F81PH, F65PH, F70PH, M64PH, M62PH, M42PH, M64PH, M62PH, M56PH, F80PH, M65PH, F85PH, M40PH, M76PH, M80PH, F82PH, M62PH, M60PH, M76PH, F83PH, F85PH, M77PH, M71PH, F90PH, F79PH, M83PH, F72PH, F76PH, M71PH, F77PH, M64PH, F54PH, M75PH, M68PH, M57PH, M55PH, F81PH, M55PH, M86PH, M47PH, M48PH, F82PH, F62PH, M53PH, M69PH, M65PH, M65PH, M77PH, M63PH, M42PH, M62PH, F94PH, M84PH, F78PH, M71PH, F69PH, F78PH, M47PH, F57PH, F83PH, F80PH, M76PH, F82PH, M71PH, M65PH, M50PH, F87PH, M60PH, F78PH, M85PH, M70PH, F92PH, M73PH, F80PH, M72PH, M78PH, F59PH, F97PH, F62PH, F32PH, F83PH, F76PH, M77PH, M41PH, F86PH, M73PH, F71PH, M76PH, F87PH, M69PH, F82PH, M53PH, M67PH, F61PH, M48PH, M75PH, M70PH, M88PH, F66PH, M70PH, F81PH, F73PH, M70PH, M74PH, F85PH, F88PH, F71PH, M65PH, F77PH, F78PH, M80PH, F56PH, F82PH, F66PH, M61PH, F75PH, M88PH, F77PH, M45PH, M74PH, M65PH, F63PH, M70PH, M75PH, M85PH, M86PH, M58PH, F78PH, F79PH, M75PH, M69PH, F96PH, M68PH, M88PH, F78PH, M71PH, M62PH, M65PH, M60PH, M71PH, F31PH, F78PH, M81PH, M83PH, F90PH, M40PH, F72PH, M68PH, F60PH, M52PH, M65PH, M75PH, F77PH, F60PH, M48PH, F82PH, F72PH, F54PH, F75PH, M92PH, F82PH, M70PH, M60PH, F79PH, M80PH, F92PH, M91PH, F86PH, F67PH, F63PH, F78PH, M35PH, M46PH, M79PH, F66PH, M75PH, M72PH, M72PH, F80PH, M75PH, F78PH, M75PH, F80PH, M50PH, F84PH, F72PH, F82PH, M63PH, F73PH, M55PH, M85PH, F73PH, F91PH, F93PH, M63PH, M69PH, F83PH, F68PH, M71PH, F92PH, M88PH, M61PH, M69PH, M75PH, F89PH, M47PH, F73PH, F84PH, F75PH, F93PH, M73PH, M41PH, M71PH, F85PH, M65PH, M78PH, M59PH, M58PH, F55PH, M43PH, M95PH, F47PH, F89PH, F81PH, F86PH, M58PH, F90PH, M68PH, F82PH, F80PH, F80PH, M69PH, F64PH, M87PH, M85PH, F86PH, F99PH, F72PH, M80PH, F89PH, F77PH, M72PH, M86PH, F83PH, F78PH, M70PH, M85PH, M85PH, F90PH, F79PH, M84PH, F56PH, F66PH, F60PH, F75PH, F50PH, F79PH, F85PH, F79PH, F72PH, M78PH, F86PH, M67PH.  
## 436781 Levels:  -2 at Deer Park\n ... Zones 22 and 23 were added to the high wind warning of  January 26. Peak winds Sitka 55MPH, Cape Decision 58MPH, and Cape Spencer 64MPH.\n

We can see that although there were catastrofic events, it makes sense that the property damage is not in the billions (ie is not in the huge catastrofic event in terms of cost).

With this analysis we can conclude that it is not necessary to look at the strange symbols in PROPDMGEXP and just focus in the known values.

knownPropDmg <- subset(tidyStorms, PROPDMGEXP %in% c("B", "k", "K", "m", "M"))

Now we modify our dataframe to have PROPDMG in the proper values (ie we will multiply PROPDMG by 103, 106 or 109 depending on the value of PROPDMGEXP)

knownPropDmg$PROPDMG[knownPropDmg$PROPDMGEXP == "B"] <- knownPropDmg$PROPDMG[knownPropDmg$PROPDMGEXP == 
    "B"] * (10^9)

knownPropDmg$PROPDMG[knownPropDmg$PROPDMGEXP %in% c("m", "M")] <- knownPropDmg$PROPDMG[knownPropDmg$PROPDMGEXP %in% 
    c("M", "m")] * (10^6)

knownPropDmg$PROPDMG[knownPropDmg$PROPDMGEXP == "K"] <- knownPropDmg$PROPDMG[knownPropDmg$PROPDMGEXP == 
    "K"] * (10^3)

We will finally sum all damage for each type to answer our question: Across the United States, which types of events have the greatest economic consequences? in terms of property damage.

propDamage <- ddply(knownPropDmg, "EVTYPE", summarise, totalDamage = sum(PROPDMG, 
    na.rm = T))
propDamage <- propDamage[order(propDamage$totalDamage, decreasing = T), ]
propDamage$EVTYPE <- factor(propDamage$EVTYPE, as.character(propDamage$EVTYPE))
propDamage <- propDamage[1:5, ]
propDamage
##                EVTYPE totalDamage
## 62              FLOOD   1.447e+11
## 178 HURRICANE/TYPHOON   6.931e+10
## 331           TORNADO   5.694e+10
## 280       STORM SURGE   4.332e+10
## 50        FLASH FLOOD   1.614e+10

Crop Damage

We will do something similar with the crop damage as we do with the property damage. First, lets look at CROPDMGEXP to see which values does it take.

table(tidyStorms$CROPDMGEXP)
## 
##             ?      0      2      B      k      K      m      M 
## 618413      7     19      1      9     21 281832      1   1994

First, lets look at the events where we have no value in CROPDMGEXP.

noCrop <- subset(tidyStorms, CROPDMGEXP == "")
sum(noCrop$CROPDMG)
## [1] 11
sum(noCrop$CROPDMG > 0)
## [1] 3
subset(noCrop, CROPDMG > 0)
##                    EVTYPE FATALITIES INJURIES PROPDMG PROPDMGEXP CROPDMG
## 221857               HAIL          0        0       5          K       3
## 238757 THUNDERSTORM WINDS          0        0       5          M       4
## 240397 THUNDERSTORM WINDS          0        0     500          K       4
##        CROPDMGEXP
## 221857           
## 238757           
## 240397

It doesn't seem to be events that have a huge crop damage, because of the type of event and because they all sum just 11 in all the CROPDMG values. So we will ignore this data.

Now we look at the rest of the events which have strong values in CROPDMGEXP (?, 0 and 2).

subset(storms, CROPDMGEXP %in% c("?", "0", "2"))$REMARKS
##  [1] Wind gusts to 96 mph Mt Tamalpias and 89 mph at the Golden Gate Bridge Petaluma river at Petuluma went 1.6 feet over flood stage.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
##  [2] Hail, up to 1.25 inch in diameter and reported as soft and slushy, accumulated to six inches deep in 15 minutes.  Many streets were closed for an hour or more due to flooding caused by heavy rain and melting hail stones.  No significant structural damage had been reported, however some trees were stripped of their leaves.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
##  [3] Thunderstorm winds downed trees and power lines across the town.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
##  [4] An intense rain shower produced a small F0 tornado in Palm Bay as it moved inland from the Atlantic.  The tornado remained on the ground only  a few blocks.  It destroyed a wooden carport, uprooted a few trees and  damaged awnings, fences and outdoor furniture.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
##  [5]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
##  [6] Numerous large tree limbs were blown down                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
##  [7] Numerous large tree limbs were blown down.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
##  [8]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
##  [9]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
## [10]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
## [11] The seasons first strongly dynamic weather system moved through the central U.S.  The surface low formed over the Rockies and advanced across the plains into South Dakota by the late afternoon hours of the 6th.  A cold front arched southeast and south of the low across central South Dakota into eastern Nebraska during the late afternoon hours.  During the afternoon hours, the middle level dry slot raced north across Kansas, eastern Nebraska, into South Dakota.  The surface showed an unstable weather situation.  To the east of the cold front, which was actually more a dry line than a cold front, temperatures reached the upper 70s to lower 80s, with dew point temperatures in the lower to middle 60s.  Dew point temperatures briefly reach 70 at a few locations during the early evening hours.  Behind the dry line, dew point temperatures dropped to the upper 30s and 40s, with a few upper 20s in under the core of the dry slot.  Directional sheer was weak, however a strong speed sheer existed.  Lifted indices were around -5° C with a nearly 80 kt wind speed in the middle levels.  Helicity values increased to around 350 M2/S2 in the pre-storm environment.  A line of thunderstorms fired up during the mid to late afternoon hours.  The storms quickly became severe as they moved into western Iowa.  The hardest hit area was the west central counties where many areas were pelted with large hail.  Monona and Crawford Counties were especially hard hit as a series of severe storms moved northeast along the main line of storms.  There were numerous reports of golf ball size hail.  One storm produced baseball size hail as it passed over the Ute area of Monona County.  Baseball size hail also fell a short time later east of Soldier.  WSR-88D radar VIL values with this storm were in the 60-65 Kg/M-2 range with the storm.  A deep meso circulation was detected over northern Shelby and southern Crawford Counties with one of the storms.  A tornado warning was issued.  A funnel cloud was reported east of Defiance in Shelby County.  It became a tornado briefly south of Manilla near the Shelby/Crawford County line.  It passed through fields, causing some crop damage.  The tornado dissipated with only a funnel cloud remaining as it passed over Manilla.  A short time earlier, these storms produced golf ball size hail southeast of Earling in Shelby County.  One farmstead reported 5 windows being broken out by the hail.  Siding on the house was also damaged.  The storms weakened as the moved east during the early evening.  As the line advanced, a weak bow echo formed along the line.  This bow echo produced gusty winds of 55 to 60 MPH as it passed over Webster, Boone, Wright, and Winnebago Counties.  Damage was minor, however many trees were downed.  The roof of one building was blown off and strewn across a field near Gowrie in Webster County.  Part of a roof was torn off of a shed at Forest City in Winnebago County.  The roof was removed from another farm building on a farmstead near Stacyville in Mitchell County.  Damage was also reported west of Pilot Mound and north of Ogden in Boone County.  High winds destroyed a 60 X 100 foot farm building on a farm north of Ogden.  Damage on that farm was close to $50,000.  The storms continued east but weakened slightly.  Winds of 40 to 55 MPH were common, however the storms remained below severe levels through the rest of the night.  
## [12]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
## [13]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
## [14]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
## [15]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
## [16]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
## [17]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
## [18]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
## [19] Winds ripped off a porch of a house.,,,,,,,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
## [20] Nearly seven inches of rain fell in some areas in a 24-hour period due to a front that was nearly stationary.  About 30 families were forced Lincoln,Graham, from their homes in Cherokee County.  The Valley River overflowed its banks, irreparably damaging five mobile homes on Old U.S. 19.  In Henderson and Cabarrus Counties, several roads were closed due to high water.  EMS personnel in Transylvania County listed five roads impassable.  Swain County officials reported two mudslides in the Natahala Gorge.  In Lincoln County communications personnel reported the South Fork River was out of its banks at the Reepsville Road Crossing.  A bridge on Old Beatties Ford Road was closed due to flooding in Rowan County.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
## [21] Trees down.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
## [22] The drought, which entered its thirteenth month, continued unabated throughout Eastern Pennsylvania the first half of September.  Rainfall was closer to normal during the second half of the month, especially in the extreme southeast.  Consequently Bradford, Bucks, Chester, Delaware, Montgomery and Philadelphia Counties either had normal or above normal rainfall for the month.  Most other counties had about 75% of normal rainfall, but precipitation deficiencies of less than 50% of normal (or around two inches below normal for the month) occurred in the Susquehanna Valley in Union, Synder, Perry and Cumberland Counties.  The rain came too late to help farmers and by the end of the month, most of Eastern Pennsylvania was under a drought emergency.  Harrisburg Pennsylvania set a record for the longest period without measurable precipitation, 28 days, from August 10 through September 7. \nSeptember started dry and a Drought Warning was declared by the Pennsylvania Department of Environmental Protection for all of Eastern Pennsylvania on the 1st.  The warning asked for voluntary conservation of non-essential water use.  Tougher, mandatory restrictions were implemented during the first half of the month in some townships in Bucks and Lancaster Counties.  In Lancaster County by September 13th about 80 separate brush fires were extinguished.  Most were caused by cigarette butts tossed from moving cars, sparks from railroads and fires which burned out of control.  Ephrata Township banned all outside burning.  On September 14th the Susquehanna River Basin Commission declared a drought warning.  On September 15th, the Delaware River Basin Commission declared a drought warning (first since 1993) for all or part of 17 eastern counties within the river's 13,539 square mile drainage basin.  Both warnings requested voluntary curbs on non-essential water use.  On September 20th, the drought warning was upgraded to a drought emergency for all of Eastern Pennsylvania except Perry, Dauphin, Lebanon, Cumberland, York and Lancaster Counties.  It was the first drought emergency declared in Pennsylvania since July 1991.  Mandatory restrictions were in place concerning water use on lawns, gardens, golf courses, paved surfaces, water fountains and vehicles. Preliminary crop losses caused by the drought were $300 million statewide.  Corn yields averaged 106 bushels per acre versus a normal of 120 bushels per acre.  Soybean yields averaged 40 bushels per acre versus a normal of 60 bushels per acre.  The late soybean crop was deemed "not worth anything".  In alfalfa fields, there were three cuttings instead of four.  Also affected by the drought were pumpkins (smaller and matured faster than normal) and Christmas trees (smaller).  The lack of water took its toll on livestock also,  although the greatest damage was done during the oppressive heat wave in the middle of July.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
## [23] Three-quarters inch hail and trees down.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
## [24]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
## [25] Highway Department reported trees down around county.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
## [26] Severe thunderstorm winds ripped the roof from a fire station, knocked down a tower and toppled two tractor semi-trailer trucks.  Dozens of trees were knocked down and extensive damage to windows was also reported.  Heavy rainfall accompanied the thunderstorm                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
## [27] The same storm system which produced damaging gradient winds earlier in the day across northern Virginia moved northeast of the Chesapeake Bay.  As it moved by, light and variable winds became northerly at speeds estimated between 40 and 50 miles per hour.  The high winds produced swells ranging from  6 to 10 feet and waves up to 8 feet.  A chartered wooden-hulled fishing boat with 23 persons aboard was attempting to navigate back to port when it was partially destroyed by the powerful waves.  All 23 persons aboard suffered some degree of hypothermia from exposure to 50°F water prior to the U.S. Coast Guard coming to their rescue.  All three deaths were due to exposure.  An elderly male died later that evening and two other men died shortly thereafter. (M64O)(M19O)(M45O)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
## 436781 Levels:  -2 at Deer Park\n ... Zones 22 and 23 were added to the high wind warning of  January 26. Peak winds Sitka 55MPH, Cape Decision 58MPH, and Cape Spencer 64MPH.\n

This remarks suggest that this events are not catastrophic in terms of crop damage so we will ignore them also.

So we finally arrive at the following dataframe

knownCropDmg <- subset(tidyStorms, CROPDMGEXP %in% c("B", "k", "K", "m", "M"))

Now we modify our dataframe to have CROPDMG in the proper values (ie we will multiply CROPDMG by 103, 106 or 109 depending on the value of CROPDMGEXP)

knownCropDmg$CROPDMG[knownCropDmg$CROPDMGEXP == "B"] <- knownCropDmg$CROPDMG[knownCropDmg$CROPDMGEXP == 
    "B"] * (10^9)
knownCropDmg$CROPDMG[knownCropDmg$CROPDMGEXP %in% c("m", "M")] <- knownCropDmg$CROPDMG[knownCropDmg$CROPDMGEXP %in% 
    c("M", "m")] * (10^6)
knownCropDmg$CROPDMG[knownCropDmg$CROPDMGEXP == "K"] <- knownCropDmg$CROPDMG[knownCropDmg$CROPDMGEXP == 
    "K"] * (10^3)

We will finally sum all damage for each type to answer our question: Across the United States, which types of events have the greatest economic consequences? in terms of crop damage.

cropDamage <- ddply(knownCropDmg, "EVTYPE", summarise, totalDamage = sum(CROPDMG, 
    na.rm = T))
cropDamage <- cropDamage[order(cropDamage$totalDamage, decreasing = T), ]
cropDamage$EVTYPE <- factor(cropDamage$EVTYPE, as.character(cropDamage$EVTYPE))
cropDamage <- cropDamage[1:5, ]
cropDamage
##         EVTYPE totalDamage
## 16     DROUGHT   1.397e+10
## 34       FLOOD   5.662e+09
## 97 RIVER FLOOD   5.029e+09
## 84   ICE STORM   5.022e+09
## 52        HAIL   3.026e+09

Results

From our analysis section we obtain 4 dataframes that I think summarize and answer the questions we have. This dataframes are fatalities, injuries, propDamage and cropDamage.

Lets look at the table for each of this dataframes.

fatalities
##             EVTYPE totalFatalities
## 834        TORNADO            5633
## 130 EXCESSIVE HEAT            1903
## 153    FLASH FLOOD             978
## 275           HEAT             937
## 464      LIGHTNING             816
injuries
##             EVTYPE totalInjuries
## 834        TORNADO         91346
## 856      TSTM WIND          6957
## 170          FLOOD          6789
## 130 EXCESSIVE HEAT          6525
## 464      LIGHTNING          5230
propDamage
##                EVTYPE totalDamage
## 62              FLOOD   1.447e+11
## 178 HURRICANE/TYPHOON   6.931e+10
## 331           TORNADO   5.694e+10
## 280       STORM SURGE   4.332e+10
## 50        FLASH FLOOD   1.614e+10
cropDamage
##         EVTYPE totalDamage
## 16     DROUGHT   1.397e+10
## 34       FLOOD   5.662e+09
## 97 RIVER FLOOD   5.029e+09
## 84   ICE STORM   5.022e+09
## 52        HAIL   3.026e+09

This tables makes sense, for example it makes sense that the events that have most damage in crop are drought and flood. So at least our results seem reasonable.

And lets plot the first 3 of them to see how much damage or health harm we have for each event type in the top 10 worst events. This will help us have a visual understanding of our results.

ggplot(fatalities, aes(x = EVTYPE, y = totalFatalities)) + geom_bar(stat = "identity") + 
    ggtitle(expression(atop("Fatalities", atop(italic("This are the total fatalities for the worst event types"), 
        ""))))

plot of chunk unnamed-chunk-21

ggplot(injuries, aes(x = EVTYPE, y = totalInjuries)) + geom_bar(stat = "identity") + 
    ggtitle(expression(atop("Injuries", atop(italic("This are the total injuries for the worst event types"), 
        ""))))

plot of chunk unnamed-chunk-21

ggplot(propDamage, aes(x = EVTYPE, y = totalDamage)) + geom_bar(stat = "identity") + 
    ggtitle(expression(atop("Property Damage", atop(italic("This is the total property damage for the worst event types"), 
        ""))))

plot of chunk unnamed-chunk-21