1 Synopsis

This analysis is designed to answer the following two questions - Question 1: Across the United States, which types of events (as indicated in the EVTYPE variable) are most harmful with respect to population health
- Question 2: Across the United States, which types of events have the greatest economic consequences?

The dataset was provided by the USA NOAA and contains a registration of weather events since 1950. Since the earlier registrations are not complete, we have worked with a subset of events since 1990. We then only used the variables that helped answer above questions, and cleaned up the categorization of the events. Finally we calculated the damage to the population’s health by summing the fatalities and the injuries per event type, and the damages to crops and properties.

Since 1990, tornado’s and excessive heat have caused the greatest health damage. Floods and hurricanes/typhoons were responsible for the highest accumulative economic damage. On average, however, hurricanes/typhoons are the most hazardous, both economically speaking and with respect to health damage while tsunamis and tropical storms are second respectively in the health domain and the economic domain.

2 Data Processing

2.1 Background information on the dataset

The data used for this research was collected by the U.S National Oceanic and Atmospheric Administration. Their storm database tracks characteristics of major storms and weather events in the United States, such as: date, place, intensity, duration, but also estimates of fatalities, injuries and property damage. NOAA has been collecting this data since the early 1950s. In the more recent years more events have been recoreded. That is most likely due to better administration.

The dataset was downloaded at 2015-08-23 from the website of cloudfront.net

The dataset is accompanied by two resources:
* a FAQ developed by the National Climatic Data Center Storm Events
* an Instruction on coding events prepared by the National Weather Service Storm Data Documentation:

2.2 Reading the dataset in R

This code was used to prepare the workspace and download the dataset:
(here moet je nog iets doen waar een map gemaakt wordt en zo, helemaal aan het eind) en dat de spatie tussen 34 en 35 weggehaald wordt)

## set the working directory, clear the workscreen 
## empty the Global Environment and load the libraries
rm(list=ls())
cls <- function() cat(rep("\n",100))
cls()
rm(cls)
setwd("C:/Users/Aletta/Documents/___Big Data/Coursera/05 Reproducible Research/PeerAssessment2/Coursera-PA2")
library(knitr)
## Warning: package 'knitr' was built under R version 3.2.1
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.2.2
##download the file (if it is not there), unzip and read it into weather.data-dataframe

if (!file.exists("storm.csv.bz2")) {
    download.file("https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2", "storm.csv.bz2")
}
if (!exists("weather.data")){
weather.data <- read.csv(bzfile("storm.csv.bz2"), header = TRUE, stringsAsFactors = FALSE)
}

The initial dataset contains 902297 observations and 37 variables:

dim(weather.data)
## [1] 902297     37
str(weather.data)
## 'data.frame':    902297 obs. of  37 variables:
##  $ STATE__   : num  1 1 1 1 1 1 1 1 1 1 ...
##  $ BGN_DATE  : chr  "4/18/1950 0:00:00" "4/18/1950 0:00:00" "2/20/1951 0:00:00" "6/8/1951 0:00:00" ...
##  $ BGN_TIME  : chr  "0130" "0145" "1600" "0900" ...
##  $ TIME_ZONE : chr  "CST" "CST" "CST" "CST" ...
##  $ COUNTY    : num  97 3 57 89 43 77 9 123 125 57 ...
##  $ COUNTYNAME: chr  "MOBILE" "BALDWIN" "FAYETTE" "MADISON" ...
##  $ STATE     : chr  "AL" "AL" "AL" "AL" ...
##  $ EVTYPE    : chr  "TORNADO" "TORNADO" "TORNADO" "TORNADO" ...
##  $ BGN_RANGE : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ BGN_AZI   : chr  "" "" "" "" ...
##  $ BGN_LOCATI: chr  "" "" "" "" ...
##  $ END_DATE  : chr  "" "" "" "" ...
##  $ END_TIME  : chr  "" "" "" "" ...
##  $ COUNTY_END: num  0 0 0 0 0 0 0 0 0 0 ...
##  $ COUNTYENDN: logi  NA NA NA NA NA NA ...
##  $ END_RANGE : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ END_AZI   : chr  "" "" "" "" ...
##  $ END_LOCATI: chr  "" "" "" "" ...
##  $ LENGTH    : num  14 2 0.1 0 0 1.5 1.5 0 3.3 2.3 ...
##  $ WIDTH     : num  100 150 123 100 150 177 33 33 100 100 ...
##  $ F         : int  3 2 2 2 2 2 2 1 3 3 ...
##  $ MAG       : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ FATALITIES: num  0 0 0 0 0 0 0 0 1 0 ...
##  $ INJURIES  : num  15 0 2 2 2 6 1 0 14 0 ...
##  $ PROPDMG   : num  25 2.5 25 2.5 2.5 2.5 2.5 2.5 25 25 ...
##  $ PROPDMGEXP: chr  "K" "K" "K" "K" ...
##  $ CROPDMG   : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ CROPDMGEXP: chr  "" "" "" "" ...
##  $ WFO       : chr  "" "" "" "" ...
##  $ STATEOFFIC: chr  "" "" "" "" ...
##  $ ZONENAMES : chr  "" "" "" "" ...
##  $ LATITUDE  : num  3040 3042 3340 3458 3412 ...
##  $ LONGITUDE : num  8812 8755 8742 8626 8642 ...
##  $ LATITUDE_E: num  3051 0 0 0 0 ...
##  $ LONGITUDE_: num  8806 0 0 0 0 ...
##  $ REMARKS   : chr  "" "" "" "" ...
##  $ REFNUM    : num  1 2 3 4 5 6 7 8 9 10 ...

2.3 Transformations 1 and 2: Downsizing the dataset

Based on the information above, NOAA’s description of their dataset, and the two questions we are supposed to answer (namely (1) which events caused the most economic damange and (2) which events cause the most damage to health), the first step is to downsize the dataset to the relevant variables and observations:

  • transformation 1 (limiting the variables): We only need columns that pertain to the event (type) and to health and economic damages. All other columns can be deleted. Based on the overview of the data above, the information needed to answer the two questions can be found in the following columns:
    1 EVTYPE
    2 FATALITIES
    3 INJURIES
    4 PROPDMG
    5 PROPDMGEXP
    6 CROPDMG
    7 CROPDMGEXP
    Furthermore, the column 1 BGN_DATE is required input for transformation 2 (see below). We will therefore keep 8 columns.
  • transformation 2 (limiting the observations): We will the earlier entries are less complete and less accurate. We will include in our analysis the all entries from the moment onwards that registration seems to be more inclusive. For that we will find the decade in which a sudden increase of registrations can be observed. In order to do this, we need the year-attribute of BGN_DATE.

2.3.1 Transformation 1: retain the variables (columns) with relevant information

neededColumns <- c("BGN_DATE", "EVTYPE", "FATALITIES","INJURIES","PROPDMG", "PROPDMGEXP", "CROPDMG","CROPDMGEXP")
weather.sel <- weather.data[, neededColumns]
rm(neededColumns)

The remaining variables are:

str(weather.sel)
## 'data.frame':    902297 obs. of  8 variables:
##  $ BGN_DATE  : chr  "4/18/1950 0:00:00" "4/18/1950 0:00:00" "2/20/1951 0:00:00" "6/8/1951 0:00:00" ...
##  $ EVTYPE    : chr  "TORNADO" "TORNADO" "TORNADO" "TORNADO" ...
##  $ FATALITIES: num  0 0 0 0 0 0 0 0 1 0 ...
##  $ INJURIES  : num  15 0 2 2 2 6 1 0 14 0 ...
##  $ PROPDMG   : num  25 2.5 25 2.5 2.5 2.5 2.5 2.5 25 25 ...
##  $ PROPDMGEXP: chr  "K" "K" "K" "K" ...
##  $ CROPDMG   : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ CROPDMGEXP: chr  "" "" "" "" ...

2.3.2 Transformation 2: retain the events registered in the more recent years

recordedYears = as.numeric(format(as.Date(weather.data$BGN_DATE, format = "%m/%d/%Y %H:%M:%S"), "%Y"))
hist(recordedYears, main = "Figure 1: Number of recorded weather events in USA since 1950", ylab="Number of events", xlab="Years" )

Figure 1

According to Figure 1, the bulk of the event was added from 1990 onwards. Without further analysis we will select all the events that were entered in 1990 or later (and drop the BGN_DATE column, since that one is not necessary anymore now).

        weather.sel = weather.sel[recordedYears>=1990,2:8]
        rm(recordedYears)

The dataset now contains 751740 observations.

2.4 Transformation 3 and 4: cleaning the data

Two more transformations are in order:
- transformation 3 (cleaning EVTYPES): As can be seen from the summary above EVTYPE contains categories such as TSTM WINDS (which stands for Thunderstorm Winds). TSTM WINDS is not one of the officle 48 categories listed by NOACCS in their codebook. So the event types-column needs to be cleaned up. We will accept a 1% amount of badly categorized events and will clean up until that level.
- transformation 4 (calculating the damages): Furthermore: the damages are calculated based on a number in the CROPDMG-column and the PROPDMG-column and a factor 10 in the respective DMGEXP-columns. The acutal number in 1000 dollars should be calculated.

2.4.1 Transformation 3: cleaning EVTYPE

The official 48 events in the codebook are (see for reference the codebook:

1-12 13-24 25-36 37-48
Astronomical Low Tide Extreme cold/Wind Chill Hurricane/Typhoon Storm Tide
Avalanche Flash Flood Ice Storm Strong Wind
Blizzard Flood Lake-Effect Snow Thunderstorm Wind
Coastal Flood Freezing Fog Lakeshore Flood Tornado
Cold/Wind Chill Frost/Freeze Lightning Tropical Depression
Debris Flow Funnel Cloud Marine Hail Tropical Storm
Dense Fog Hail Marine High Wind Tsunami
Dense Smoke Heat Marine Strong Wind Volcanic Ash
Drought Heavy Rain Marine Thunderstorm Wind Waterspout
Dust Devil Heavy Snow Rip Current Wildfire
Dust Storm High Surf Seiche Winter Storm
Excessive Heat High Wind Sleet Winter Weather

However, the data set contains `r nrow(data.frame(table(weather.sel$EVTYPE)))’ unique event types. The function checkEvents(df) is used to check (1) the percentage of miscategorized events and to show the event categorization that causes the greatest problems. We will clean up EVTYPES until the percentage of mismatched events drops below 1% (<0.01)

head(weather.sel)
##         EVTYPE FATALITIES INJURIES PROPDMG PROPDMGEXP CROPDMG CROPDMGEXP
## 4408      HAIL          0        0     0.0                  0           
## 4409 TSTM WIND          0        0     0.0                  0           
## 4410 TSTM WIND          0        0     0.0                  0           
## 4411 TSTM WIND          0        0     0.0                  0           
## 4412   TORNADO          0       28     2.5          M       0           
## 4413 TSTM WIND          0        0     0.0                  0
events <- c("ASTRONOMICAL LOW TIDE", "AVALANCHE", "BLIZZARD", "COASTAL FLOOD","COLD/WIND CHILL", "DEBRIS FLOW", "DENSE FOG", "DENSE SMOKE", "DROUGHT", "DUST DEVIL", "DUST STORM", "EXCESSIVE HEAT", "EXTREME COLD/WIND CHILL", "FLASH FLOOD", "FLOOD", "FREEZING", "FROST/FREEZE", "FUNNEL CLOUD", "HAIL", "HEAT", "HEAVY RAIN", "HEAVY SNOW", "HIGH SURF", "HIGH WIND", "HURRICANE/TYPHOON", "ICE STORM", "LAKESHORE FLOOD", "LAKE-EFFECT SNOW", "LIGHTNING", "MARINE HAIL", "MARINE HIGH WIND", "MARINE STRONG WIND", "MARINE THUNDERSTORM WIND", "RIP CURRENT","SEICHE", "SLEET", "STORM TIDE", "STRONG WIND", "THUNDERSTORM WIND", "TORNADO","TROPICAL DEPRESSION", "TROPICAL STORM", "TSUNAMI", "VOLCANIC ASH", "WATERSPOUT", "WILDFIRE", "WINTER STORM", "WINTER WEATHER")

checkEvents = function(df) {
        df$TYPEMATCH = ifelse(df$EVTYPE %in% events, TRUE, FALSE)
        non.typed = df$EVTYPE[df$TYPEMATCH==FALSE]
        print(length(non.typed))
        print(length(non.typed)/nrow(weather.sel))
        table = data.frame(table(non.typed))
        names(table) = c("Event","Freq")
        tail(table[order(table$Freq),])
}

## step 1: run a check
checkEvents(weather.sel)
## [1] 195174
## [1] 0.2596297
##                    Event   Freq
## 913     WILD/FOREST FIRE   1457
## 354           HIGH WINDS   1533
## 879 URBAN/SML STREAM FLD   3392
## 459     MARINE TSTM WIND   6175
## 750   THUNDERSTORM WINDS  20843
## 817            TSTM WIND 147987

In the uncleaned status almost 26% of the events cannot be categorized according to the 48 official categories. The cleaning up will follow these steps:
1. make sure all strings in EVTYPES are in capitals - then check again 2. clean up the mismatched categories with the highest frequencies (as stated by the table above) reported after the first check - . 3. check (repeat the process if the percentages of mismatched observations is still more than 1%)

## first make all entries capitals, then check again
weather.sel$EVTYPE = toupper(weather.sel$EVTYPE)
checkEvents(weather.sel)
## [1] 195099
## [1] 0.2595299
##                    Event   Freq
## 831     WILD/FOREST FIRE   1457
## 315           HIGH WINDS   1533
## 799 URBAN/SML STREAM FLD   3392
## 413     MARINE TSTM WIND   6175
## 675   THUNDERSTORM WINDS  20843
## 740            TSTM WIND 147989
##get tstm
weather.sel[grep( "^TSTM" , weather.sel$EVTYPE, perl= TRUE ), "EVTYPE" ] = "THUNDERSTORM WIND"
##get thunderstorm winds
weather.sel[grep( "^THUNDERSTORM WINDS" , weather.sel$EVTYPE, perl= TRUE ), "EVTYPE" ] = "THUNDERSTORM WIND"
##get marine tstm
weather.sel[grep( "^MARINE TSTM" , weather.sel$EVTYPE, perl= TRUE ), "EVTYPE" ] = "MARINE THUNDERSTORM WIND"
##get urban/sml stream fld
weather.sel[grep( "^URBAN/SML STREAM FLD" , weather.sel$EVTYPE, perl= TRUE ), "EVTYPE" ] = "FLOOD"
##get high winds
weather.sel[grep( "^HIGH WINDS" , weather.sel$EVTYPE, perl= TRUE ), "EVTYPE" ] = "HIGH WIND"
##get wild/forest fire
weather.sel[grep( "FIRE" , weather.sel$EVTYPE, perl= TRUE ), "EVTYPE" ] = "WILDFIRE"
checkEvents(weather.sel)
## [1] 12374
## [1] 0.01646048
##                  Event Freq
## 349          LANDSLIDE  600
## 502               SNOW  617
## 144  FLOOD/FLASH FLOOD  625
## 112       EXTREME COLD  657
## 134     FLASH FLOODING  682
## 763 WINTER WEATHER/MIX 1104
## repeat the process
## get winter weather mix
weather.sel[grep( "WINTER WEATHER/MIX" , weather.sel$EVTYPE, perl= TRUE ), "EVTYPE" ] = "WINTER WEATHER"
## get flash flooding (on position 3 and 5)
weather.sel[grep( "FLASH FLOOD" , weather.sel$EVTYPE, perl= TRUE ), "EVTYPE" ] = "FLASH FLOOD"
## get extreme cold
weather.sel[grep( "EXTREME COLD" , weather.sel$EVTYPE, perl= TRUE ), "EVTYPE" ] = "EXTREME COLD/WIND CHILL"
## get snow
weather.sel[grep( "^SNOW" , weather.sel$EVTYPE, perl= TRUE ), "EVTYPE" ] = "HEAVY SNOW"
## get landslide
weather.sel[grep( "^LANDSLIDE" , weather.sel$EVTYPE, perl= TRUE ), "EVTYPE" ] = "DEBRIS FLOW"
checkEvents(weather.sel)
## [1] 7811
## [1] 0.01039056
##             Event Freq
## 648   URBAN FLOOD  251
## 143 FREEZING RAIN  260
## 481   STORM SURGE  261
## 443  RIP CURRENTS  304
## 690          WIND  346
## 137           FOG  538
## repeat the process per event type: get fog
weather.sel[grep( "^FOG" , weather.sel$EVTYPE, perl= TRUE ), "EVTYPE" ] = "DENSE FOG"
checkEvents(weather.sel)
## [1] 7272
## [1] 0.009673557
##                    Event Freq
## 261 HEAVY SURF/HIGH SURF  228
## 646          URBAN FLOOD  251
## 141        FREEZING RAIN  260
## 479          STORM SURGE  261
## 441         RIP CURRENTS  304
## 688                 WIND  346
##subset the events that are correctly categorized and delete the others
weather.sel$TYPEMATCH = ifelse(weather.sel$EVTYPE %in% events, TRUE, FALSE)
weather.sel = subset(weather.sel, weather.sel$TYPEMATCH == TRUE)
rm(events)
rm(checkEvents)
##the type match variable is not necessary anymore
weather.sel = weather.sel[,1:7]

There are now 744468 remaining observations. The categories are dispersed as follows:

EventTypes = data.frame(table(weather.sel$EVTYPE))
names(EventTypes) = c("Event","Freq since 1990")
EventTypes = EventTypes[order(EventTypes$Freq, decreasing = TRUE),]
rownames(EventTypes) = 1:nrow(EventTypes)
EventTypes
##                       Event Freq since 1990
## 1         THUNDERSTORM WIND          252681
## 2                      HAIL          240945
## 3               FLASH FLOOD           55667
## 4                   TORNADO           29764
## 5                     FLOOD           28720
## 6                 HIGH WIND           21775
## 7                HEAVY SNOW           16511
## 8                 LIGHTNING           15754
## 9  MARINE THUNDERSTORM WIND           11987
## 10               HEAVY RAIN           11742
## 11             WINTER STORM           11433
## 12           WINTER WEATHER            8149
## 13             FUNNEL CLOUD            6844
## 14                 WILDFIRE            4240
## 15               WATERSPOUT            3796
## 16              STRONG WIND            3569
## 17                 BLIZZARD            2719
## 18                  DROUGHT            2488
## 19                ICE STORM            2006
## 20                DENSE FOG            1832
## 21           EXCESSIVE HEAT            1678
## 22  EXTREME COLD/WIND CHILL            1659
## 23             FROST/FREEZE            1343
## 24                     HEAT             767
## 25                HIGH SURF             734
## 26           TROPICAL STORM             690
## 27            COASTAL FLOOD             656
## 28         LAKE-EFFECT SNOW             636
## 29              DEBRIS FLOW             609
## 30          COLD/WIND CHILL             539
## 31              RIP CURRENT             470
## 32              MARINE HAIL             442
## 33               DUST STORM             427
## 34                AVALANCHE             386
## 35    ASTRONOMICAL LOW TIDE             174
## 36               DUST DEVIL             149
## 37         MARINE HIGH WIND             135
## 38        HURRICANE/TYPHOON              88
## 39      TROPICAL DEPRESSION              60
## 40                    SLEET              59
## 41       MARINE STRONG WIND              48
## 42          LAKESHORE FLOOD              23
## 43             VOLCANIC ASH              23
## 44                   SEICHE              21
## 45                  TSUNAMI              20
## 46              DENSE SMOKE              10
rm(EventTypes)

1.3.2 Transformation 4: calculating the damages

The columns PROPDMGEXP en CROPDMGEXP give the unit in which the number in PROPDMG en CROPDMG are expressed. For instance, 1.6 in PROPDMG and K in PROPDMGEXP mean 1600 dollars. 1.6 in PROPDMG and M in PROPDMGEXP means 1.6 million dollars damage. Below the PROP and CROP damages are recalculated in million dollars. And the total economic and healt damages are calculated by adding PROP and CROP damages and by adding fatalities and injuries.

possValues = c("K","M", "B","0","3","4","5","6","7")
exponents = c(3, 6,9,0,3,4,5,6,7)
for (i in 1:length(possValues)) {
        weather.sel$CROPDMG[weather.sel$CROPDMGEXP == possValues[i]] <- weather.sel$CROPDMG[weather.sel$CROPDMGEXP == possValues[i]] * (10^(exponents[i])/10^6)
        weather.sel$PROPDMG[weather.sel$PROPDMGEXP == possValues[i]] <-         weather.sel$PROPDMG[weather.sel$PROPDMGEXP == possValues[i]] * (10^(exponents[i])/10^6)
}
weather.sel$'Econ_DMG(Mill)' <- as.numeric(weather.sel$CROPDMG) + as.numeric(weather.sel$PROPDMG)
rm(possValues)
rm(exponents)
rm(i)
weather.sel$HealthDamage = as.numeric(weather.sel$FATALITIES)+as.numeric(weather.sel$INJURIES)
##since the value in PROPDMGEXP en CROPDMGEXP has played its role they can be deleted
weather.sel = weather.sel[,c(1:4,6,8:9)]
names(weather.sel) = c("EVTYPE", "FATALITIES", "INJURIES", "PROP_DMG(Mill)", "CROP_DMG(Mill)", "ECON_DMG(Mill)", "HEALTH_DMG")

3 Results

The analysis will first show which type of event has done the most accumulative damages since the 1990s:

weather.sum = aggregate(weather.sel[,2:7], list(weather.sel$EVTYPE), sum)
names(weather.sum) = c("EVTYPE", "FATALITIES", "INJURIES", "PROP_DMG(Mill)", "CROP_DMG(Mill)", "ECON_DMG(Mill)", "HEALTH_DMG")
weather.sum.health = weather.sum[,c(1, 7, 2:3)]
weather.sum.health = weather.sum.health[order(weather.sum.health$HEALTH_DMG, decreasing = TRUE ),]
rownames(weather.sum.health) = 1:nrow(weather.sum)
weather.sum.econ = weather.sum[,c(1, 6, 4:5)]
weather.sum.econ = weather.sum.econ[order(weather.sum.econ$`ECON_DMG(Mill)`, decreasing = TRUE ),]
rownames(weather.sum.econ) = 1:nrow(weather.sum)

head(weather.sum.health, 10)
##               EVTYPE HEALTH_DMG FATALITIES INJURIES
## 1            TORNADO      28426       1752    26674
## 2     EXCESSIVE HEAT       8428       1903     6525
## 3  THUNDERSTORM WIND       8053        530     7523
## 4              FLOOD       7366        498     6868
## 5          LIGHTNING       6046        816     5230
## 6               HEAT       3037        937     2100
## 7        FLASH FLOOD       2837       1035     1802
## 8          ICE STORM       2064         89     1975
## 9          HIGH WIND       1735        286     1449
## 10          WILDFIRE       1698         90     1608
head(weather.sum.econ, 10)
##               EVTYPE ECON_DMG(Mill) PROP_DMG(Mill) CROP_DMG(Mill)
## 1              FLOOD     150393.476     144723.019      5670.4565
## 2  HURRICANE/TYPHOON      71913.713      69305.840      2607.8728
## 3            TORNADO      30946.689      30531.735       414.9533
## 4        FLASH FLOOD      19348.389      17806.202      1542.1871
## 5               HAIL      19242.804      15797.267      3445.5375
## 6            DROUGHT      15018.672       1046.106     13972.5660
## 7  THUNDERSTORM WIND      11456.328      10219.947      1236.3810
## 8          ICE STORM       8967.041       3944.928      5022.1135
## 9           WILDFIRE       8904.910       8501.629       403.2816
## 10    TROPICAL STORM       8382.237       7703.891       678.3460
rm(weather.sum)
rm(weather.sum.health)
rm(weather.sum.econ)

Finally, the analysis will show which type of event has done the most damage on average per event since the 1990s:

##AVERAGE
weather.mean = aggregate(weather.sel[,2:7], list(weather.sel$EVTYPE), mean)
names(weather.mean) = c("EVTYPE", "FATALITIES", "INJURIES", "PROP_DMG(Mill)", "CROP_DMG(Mill)", "ECON_DMG(Mill)", "HEALTH_DMG")
weather.mean.health = weather.mean[,c(1, 7, 2:3)]
weather.mean.health = weather.mean.health[order(weather.mean.health$HEALTH_DMG, decreasing = TRUE ),]
rownames(weather.mean.health) = 1:nrow(weather.mean)
weather.mean.health[c(2,3,4)]=round(weather.mean.health[c(2,3,4)],1)
head(weather.mean.health, 10)
##                EVTYPE HEALTH_DMG FATALITIES INJURIES
## 1   HURRICANE/TYPHOON       15.2        0.7     14.5
## 2             TSUNAMI        8.1        1.6      6.5
## 3      EXCESSIVE HEAT        5.0        1.1      3.9
## 4                HEAT        4.0        1.2      2.7
## 5         RIP CURRENT        1.3        0.8      0.5
## 6          DUST STORM        1.1        0.1      1.0
## 7           ICE STORM        1.0        0.0      1.0
## 8           AVALANCHE        1.0        0.6      0.4
## 9             TORNADO        1.0        0.1      0.9
## 10 MARINE STRONG WIND        0.8        0.3      0.5
weather.mean.econ = weather.mean[,c(1, 6, 4:5)]
weather.mean.econ = weather.mean.econ[order(weather.mean.econ$`ECON_DMG(Mill)`, decreasing = TRUE ),]
rownames(weather.mean.econ) = 1:nrow(weather.mean)
weather.mean.econ[c(2,3,4)]=round(weather.mean.econ[c(2,3,4)],0)
head(weather.mean.econ, 10)
##                     EVTYPE ECON_DMG(Mill) PROP_DMG(Mill) CROP_DMG(Mill)
## 1        HURRICANE/TYPHOON            817            788             30
## 2           TROPICAL STORM             12             11              1
## 3                  TSUNAMI              7              7              0
## 4                  DROUGHT              6              0              6
## 5                    FLOOD              5              5              0
## 6                ICE STORM              4              2              3
## 7                 WILDFIRE              2              2              0
## 8                  TORNADO              1              1              0
## 9  EXTREME COLD/WIND CHILL              1              0              1
## 10            FROST/FREEZE              1              0              1
rm(weather.mean)
rm(weather.mean.health)
rm(weather.mean.econ)