SYNOPSIS
The project is an analysis on the impact of severe weather conditions on health of the population and economy. It is an exploration of U.S. National Oceanic & Atmospheric Administration’s (NOAA) storm database.
This project uses the U.S.NOAA storm database for analysing the adverse effects caused by the storm or severe weather conditions on the population health and economy, especially on crop and property. It tracks and analyzes the characteristics of major weather events in the US, including when and where they occurred and it’s impact on health and economy.
The analysis shows that tornadoes are the reason for highest fatalities and injuries in the US. It also shows that the maximum crop damage in the country is due to droughts while floods are responsible for maximum property damage.
DATA PROCESSING
1. Installing packages
knitr::opts_chunk$set(echo = TRUE)
## Install packages and Load the following libraries
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.0.2
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(rmarkdown)
library(knitr)
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.0.2
library(R.utils)
## Warning: package 'R.utils' was built under R version 4.0.2
## Loading required package: R.oo
## Loading required package: R.methodsS3
## R.methodsS3 v1.8.0 (2020-02-14 07:10:20 UTC) successfully loaded. See ?R.methodsS3 for help.
## R.oo v1.23.0 successfully loaded. See ?R.oo for help.
##
## Attaching package: 'R.oo'
## The following object is masked from 'package:R.methodsS3':
##
## throw
## The following objects are masked from 'package:methods':
##
## getClasses, getMethods
## The following objects are masked from 'package:base':
##
## attach, detach, load, save
## R.utils v2.9.2 successfully loaded. See ?R.utils for help.
##
## Attaching package: 'R.utils'
## The following object is masked from 'package:utils':
##
## timestamp
## The following objects are masked from 'package:base':
##
## cat, commandArgs, getOption, inherits, isOpen, nullfile, parse,
## warnings
## Sets the system time
Sys.setlocale("LC_TIME", "English")
## [1] "English_United States.1252"
2. Download the storm data in the working directory and read the file into Rstudio
## Download the file using the link: "https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2" and unzip it in the working directory.Use 'download.file()' for downloading and bunzip2() function to uncompress. Read the .csv file into Rstudio as follows.
storm<- read.csv("StormData.csv", header=TRUE, sep=",")
## Look at the data using summary() function to get an idea of the entire data
summary(storm)
## STATE__ BGN_DATE BGN_TIME TIME_ZONE
## Min. : 1.0 Length:902297 Length:902297 Length:902297
## 1st Qu.:19.0 Class :character Class :character Class :character
## Median :30.0 Mode :character Mode :character Mode :character
## Mean :31.2
## 3rd Qu.:45.0
## Max. :95.0
##
## COUNTY COUNTYNAME STATE EVTYPE
## Min. : 0.0 Length:902297 Length:902297 Length:902297
## 1st Qu.: 31.0 Class :character Class :character Class :character
## Median : 75.0 Mode :character Mode :character Mode :character
## Mean :100.6
## 3rd Qu.:131.0
## Max. :873.0
##
## BGN_RANGE BGN_AZI BGN_LOCATI END_DATE
## Min. : 0.000 Length:902297 Length:902297 Length:902297
## 1st Qu.: 0.000 Class :character Class :character Class :character
## Median : 0.000 Mode :character Mode :character Mode :character
## Mean : 1.484
## 3rd Qu.: 1.000
## Max. :3749.000
##
## END_TIME COUNTY_END COUNTYENDN END_RANGE
## Length:902297 Min. :0 Mode:logical Min. : 0.0000
## Class :character 1st Qu.:0 NA's:902297 1st Qu.: 0.0000
## Mode :character Median :0 Median : 0.0000
## Mean :0 Mean : 0.9862
## 3rd Qu.:0 3rd Qu.: 0.0000
## Max. :0 Max. :925.0000
##
## END_AZI END_LOCATI LENGTH WIDTH
## Length:902297 Length:902297 Min. : 0.0000 Min. : 0.000
## Class :character Class :character 1st Qu.: 0.0000 1st Qu.: 0.000
## Mode :character Mode :character Median : 0.0000 Median : 0.000
## Mean : 0.2301 Mean : 7.503
## 3rd Qu.: 0.0000 3rd Qu.: 0.000
## Max. :2315.0000 Max. :4400.000
##
## F MAG FATALITIES INJURIES
## Min. :0.0 Min. : 0.0 Min. : 0.0000 Min. : 0.0000
## 1st Qu.:0.0 1st Qu.: 0.0 1st Qu.: 0.0000 1st Qu.: 0.0000
## Median :1.0 Median : 50.0 Median : 0.0000 Median : 0.0000
## Mean :0.9 Mean : 46.9 Mean : 0.0168 Mean : 0.1557
## 3rd Qu.:1.0 3rd Qu.: 75.0 3rd Qu.: 0.0000 3rd Qu.: 0.0000
## Max. :5.0 Max. :22000.0 Max. :583.0000 Max. :1700.0000
## NA's :843563
## PROPDMG PROPDMGEXP CROPDMG CROPDMGEXP
## Min. : 0.00 Length:902297 Min. : 0.000 Length:902297
## 1st Qu.: 0.00 Class :character 1st Qu.: 0.000 Class :character
## Median : 0.00 Mode :character Median : 0.000 Mode :character
## Mean : 12.06 Mean : 1.527
## 3rd Qu.: 0.50 3rd Qu.: 0.000
## Max. :5000.00 Max. :990.000
##
## WFO STATEOFFIC ZONENAMES LATITUDE
## Length:902297 Length:902297 Length:902297 Min. : 0
## Class :character Class :character Class :character 1st Qu.:2802
## Mode :character Mode :character Mode :character Median :3540
## Mean :2875
## 3rd Qu.:4019
## Max. :9706
## NA's :47
## LONGITUDE LATITUDE_E LONGITUDE_ REMARKS
## Min. :-14451 Min. : 0 Min. :-14455 Length:902297
## 1st Qu.: 7247 1st Qu.: 0 1st Qu.: 0 Class :character
## Median : 8707 Median : 0 Median : 0 Mode :character
## Mean : 6940 Mean :1452 Mean : 3509
## 3rd Qu.: 9605 3rd Qu.:3549 3rd Qu.: 8735
## Max. : 17124 Max. :9706 Max. :106220
## NA's :40
## REFNUM
## Min. : 1
## 1st Qu.:225575
## Median :451149
## Mean :451149
## 3rd Qu.:676723
## Max. :902297
##
## Look at the names of the columns in the data
names(storm)
## [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"
3. Reducing the data to the columns needed for analysis
To perform the analysis, the data has to be processed by taking into account only those columns and rows that will be required and assist in finding out the answers to the questions asked in the project. The following code subsets the columns necessary to find the losses in population health and economy sorted by the events.
The abbreviated column names in the dataset are: EVTYPE- EVENT TYPE, PROPDMG- PROPERTY DAMAGE, CROPDMG- CROP DAMAGE, PROPDMGEXP- PROPERTY DAMAGE EXPONENT, CROPDMGEXP- CROP DAMAGE EXPONENT
## Concatenating the required columns in the variable 'reduced'.
reduced<-c("EVTYPE", "FATALITIES", "INJURIES", "PROPDMG", "PROPDMGEXP", "CROPDMG", "CROPDMGEXP")
## Subsetting the data 'storm' for the required columns and stored in the variable 'stormred'
stormred<- storm[reduced]
## Checking the dimensions of stormred.
dim(stormred)
## [1] 902297 7
## Look at the column names of stormred
names(stormred)
## [1] "EVTYPE" "FATALITIES" "INJURIES" "PROPDMG" "PROPDMGEXP"
## [6] "CROPDMG" "CROPDMGEXP"
4. Processing the data ‘storm’ for the question,‘Q1’.
Q1:- Across the United States, which types of events are most harmful with respect to population health?
## The fatalities and injuries are the loss to the population health caused by the events of severe weather conditions. These can be reviewed as follows.
## Using the aggregate function sort out the fatalities based on the event type from the data in 'stormred'
fatalities<- aggregate(FATALITIES~EVTYPE, data=stormred, FUN=sum)
## Sort out the top 10 fatalities in descending order from the data in 'fatalities'
top10fatalities<- fatalities[order(-fatalities$FATALITIES),][1:10,]
## Using the aggregate function sort out the injuries based on the event type from the data in 'stormred'
injuries<- aggregate(INJURIES~EVTYPE, data=stormred, FUN=sum)
## Sort out the top 10 injuries in descending order from the data in 'injuries'
top10injuries<- injuries[order(-injuries$INJURIES),][1:10,]
## To find out total health loss due to severe weather conditions mentioned in 'EVTYPE' bind the columns 'FATALITIES' and 'INJURIES' of the 'stormred' and sort it by 'EVTYPE' using aggregate function
pophealth<- aggregate(cbind(FATALITIES, INJURIES)~EVTYPE, data=stormred, FUN=sum, na.rm=TRUE)
## Add a column combining fatalities and injuries called 'loss'
pophealth$loss<- pophealth$FATALITIES+pophealth$INJURIES
## Sort out top 10 reasons for fatalities and injuries combined in descending order from the data in 'pophealth'
pophealth<- arrange(pophealth, desc(loss))
top10pophealth<- pophealth[1:10,]
5. Processing the data ‘storm’ for the question,‘Q2’.
Q2:- Across the United States, which types of events have the greatest economic consequences?
## The economic damages caused due to events of severe weather conditions include property damages and crop damages. After reviewing the column names, the need for converting the exponential values of crop and property damages arises. This is done by assigning the numbers to exponential values. Calculating the total property and crop damage values by multiplying the damage values with exponential ones for each variable helps with the analysis that answers the above question.
## Check the values of PROPDMGEXP column in stormred data by listing each value
unique(stormred$PROPDMGEXP)
## [1] "K" "M" "" "B" "m" "+" "0" "5" "6" "?" "4" "2" "3" "h" "7" "H" "-" "1" "8"
## Assigning the values for property exponent of stormred data
stormred$PROPEXP[stormred$PROPDMGEXP=="K"]<-1000
stormred$PROPEXP[stormred$PROPDMGEXP=="M"]<-1000000
stormred$PROPEXP[stormred$PROPDMGEXP==""]<-1
stormred$PROPEXP[stormred$PROPDMGEXP=="B"]<-1000000000
stormred$PROPEXP[stormred$PROPDMGEXP=="m"]<-1000000
stormred$PROPEXP[stormred$PROPDMGEXP=="0"]<-1
stormred$PROPEXP[stormred$PROPDMGEXP=="5"]<-100000
stormred$PROPEXP[stormred$PROPDMGEXP=="6"]<-1000000
stormred$PROPEXP[stormred$PROPDMGEXP=="4"]<-10000
stormred$PROPEXP[stormred$PROPDMGEXP=="2"]<-100
stormred$PROPEXP[stormred$PROPDMGEXP=="3"]<-1000
stormred$PROPEXP[stormred$PROPDMGEXP=="h"]<-100
stormred$PROPEXP[stormred$PROPDMGEXP=="7"]<-10000000
stormred$PROPEXP[stormred$PROPDMGEXP=="H"]<-100
stormred$PROPEXP[stormred$PROPDMGEXP=="1"]<-10
stormred$PROPEXP[stormred$PROPDMGEXP=="8"]<-100000000
## Assigning 0 to invalid exponents
stormred$PROPEXP[stormred$PROPDMGEXP=="+"]<-0
stormred$PROPEXP[stormred$PROPDMGEXP=="-"]<-0
stormred$PROPEXP[stormred$PROPDMGEXP=="?"]<-0
## Calculating the total property damage value by multiplying the property damage and property exponent value
stormred$PROPDMGVAL<- stormred$PROPDMG*stormred$PROPEXP
## Checking the unique values in the specified column by listing the values
unique(stormred$PROPDMGVAL)
## [1] 2.5000e+04 2.5000e+03 2.5000e+06 2.5000e+05 0.0000e+00 3.0000e+01
## [7] 2.5000e+02 2.5000e+07 2.5000e+08 5.0000e+09 1.0000e+08 5.0000e+04
## [13] 5.0000e+06 5.0000e+05 4.8000e+07 2.0000e+07 5.0000e+03 2.0000e+03
## [19] 3.5000e+04 3.0000e+03 5.0000e+02 9.0000e+05 1.0000e+03 4.0000e+03
## [25] 1.0000e+04 1.5000e+03 2.0000e+04 4.5000e+04 2.0000e+02 1.2000e+04
## [31] 8.0000e+03 2.2000e+04 5.5000e+04 4.0000e+04 1.4000e+04 8.5000e+04
## [37] 4.2000e+04 1.5000e+04 1.0000e+05 3.0000e+04 5.0000e+01 3.8000e+04
## [43] 8.0000e+04 1.8000e+04 6.5000e+05 6.0000e+03 3.0000e+02 2.4000e+04
## [49] 3.2000e+04 7.0000e+03 2.8000e+04 7.0000e+04 9.5000e+04 1.0000e+02
## [55] 6.5000e+04 4.0000e+02 9.0000e+04 3.7000e+04 5.0000e+07 2.0000e+05
## [61] 1.0000e+06 2.3000e+04 5.6000e+04 4.5000e+05 1.0000e+07 7.5000e+06
## [67] 1.5000e+02 4.7000e+04 4.1000e+06 5.5000e+03 9.8000e+04 1.6000e+06
## [73] 1.3000e+06 3.5000e+06 7.5000e+04 6.0000e+05 5.0000e+00 3.7000e+01
## [79] 3.0000e+05 1.5000e+05 4.8000e+06 3.3100e+08 6.1900e+08 5.5000e+06
## [85] 6.0000e+04 6.0000e+07 7.0000e+06 4.1000e-01 5.0000e-01 1.5000e+07
## [91] 8.4000e+05 1.1000e+04 1.0000e+00 1.7000e+05 1.5000e+00 2.0000e+01
## [97] 4.5000e+03 4.0000e+05 2.0000e+00 4.0000e+00 2.5000e+01 1.7000e+07
## [103] 3.0000e+06 2.4000e+05 1.0000e+01 7.0000e-01 4.0000e+06 1.5000e+01
## [109] 1.5000e+06 2.3000e+08 2.1000e+09 1.6000e+09 1.0000e+09 8.6000e+05
## [115] 2.0000e+06 5.7100e+05 7.0000e+02 2.8000e+06 8.0000e+05 1.2000e+05
## [121] 7.0000e+05 2.7500e+05 1.1000e+06 3.0000e+00 1.7500e+05 1.7000e+03
## [127] 2.0400e+05 7.5000e+01 1.2500e+05 8.0000e+01 3.5000e+05 6.5000e+03
## [133] 1.3500e+05 7.0000e+01 7.5000e+07 4.0000e+01 6.0000e+01 4.5000e+01
## [139] 9.0000e+03 8.0000e+02 6.0000e+02 9.0000e+02 1.4000e+03 3.4000e+03
## [145] 2.4000e+07 1.1000e+05 6.0000e+06 1.4000e+06 1.9000e+06 3.5000e+03
## [151] 1.2000e+07 3.3000e+03 1.2000e+06 7.7000e+03 2.6000e+07 7.6000e+03
## [157] 4.1000e+03 1.0600e+05 5.1800e+05 8.8000e+06 6.4000e+03 1.2000e+03
## [163] 8.2000e+03 8.3000e+03 5.4000e+03 4.4000e+03 2.7000e+05 1.8000e+06
## [169] 4.3000e+03 1.4000e+05 1.3000e+05 1.0000e-01 3.8000e+06 2.4000e+06
## [175] 7.5000e+05 3.5000e+01 4.9000e+06 1.0500e+05 8.5000e+05 1.6000e+04
## [181] 3.3000e+05 3.0300e+05 3.4000e+04 1.7600e+05 2.5000e+09 1.7000e+04
## [187] 1.6000e+03 6.7000e+03 8.5000e+03 2.4000e+03 2.2000e+03 6.3000e+05
## [193] 1.4000e+08 4.2000e+03 1.3000e+03 5.2000e+03 7.5000e+03 8.7000e+03
## [199] 5.5000e+01 1.5500e+05 2.7000e+03 1.9500e+05 3.2000e+03 1.8000e+05
## [205] 8.4000e+03 1.6000e+05 8.9700e+05 1.3200e+05 1.8500e+05 1.9200e+05
## [211] 6.1000e+04 8.1000e+05 3.7400e+05 1.3000e+04 3.4000e+07 1.1800e+05
## [217] 6.8000e+08 4.7500e+05 4.0000e+07 6.0000e+00 7.0000e+00 9.0000e+00
## [223] 3.6000e+06 8.0000e+00 1.4500e+05 2.6000e+05 2.1000e+05 4.1500e+05
## [229] 2.2000e+05 1.1500e+05 3.9000e+06 3.7500e+05 8.0000e+06 4.6000e+05
## [235] 2.2500e+05 6.2000e+04 5.2000e+05 1.7000e+06 4.6000e+06 3.2500e+05
## [241] 3.0000e+07 2.2000e+08 3.3000e+06 6.6000e+06 1.2000e+09 1.2000e+01
## [247] 4.3000e+01 6.7500e+05 3.5000e+02 6.4000e+05 4.7000e+01 7.8000e+04
## [253] 2.7000e+04 6.7000e+01 6.2000e+06 3.6000e+04 5.3000e+04 3.8000e+05
## [259] 5.9500e+05 1.2500e+06 3.2000e+05 6.3000e+04 1.5000e+08 9.0000e+06
## [265] 2.1000e+06 7.5000e+02 2.3000e+05 4.5000e+06 1.2300e+07 3.7400e+07
## [271] 1.2000e+08 8.7000e+06 3.1000e+04 5.2000e+06 4.7000e+05 4.4600e+07
## [277] 4.4000e+04 1.3500e+07 4.4000e+07 1.1000e+07 4.4700e+07 4.4000e+06
## [283] 1.4500e+07 2.1500e+04 5.3000e+05 1.8350e+05 1.2500e+04 1.8400e+06
## [289] 9.9000e+04 3.8000e+03 5.5000e+05 3.2000e+06 5.2000e+04 2.9000e+06
## [295] 1.2800e+07 1.0700e+06 7.2000e+06 5.4700e+06 5.9400e+05 2.3100e+05
## [301] 5.6100e+05 5.7000e+05 2.3300e+06 1.0200e+07 1.4980e+07 1.1400e+06
## [307] 1.0750e+07 3.2000e+07 1.4960e+07 4.1700e+04 5.4000e+06 2.2000e+06
## [313] 6.5000e+06 5.8000e+06 8.5000e+06 1.9000e+04 1.3000e+07 2.1000e+03
## [319] 7.3340e+05 6.8000e+05 6.2000e+05 5.8000e+04 1.8800e+07 1.4200e+07
## [325] 1.0720e+07 3.1000e+07 2.7000e+06 4.3000e+06 7.2000e+05 1.6800e+06
## [331] 7.3000e+04 7.9000e+06 1.7800e+07 5.7000e+06 9.3000e+06 7.6000e+06
## [337] 1.9000e+07 6.5500e+06 1.3300e+05 2.1000e+04 2.9000e+04 8.9000e+04
## [343] 2.6000e+04 1.1500e+07 4.1000e+04 1.4400e+07 2.3000e+07 2.0100e+06
## [349] 3.1000e+05 1.4025e+08 1.8000e+07 5.1000e+05 7.9215e+08 2.0000e+08
## [355] 1.8000e+08 1.4250e+07 3.3700e+06 1.8700e+05 3.7200e+06 5.0900e+06
## [361] 1.2600e+06 3.4300e+06 3.5200e+05 5.2900e+05 1.2800e+05 5.2500e+06
## [367] 2.1000e+07 2.8000e+05 1.0500e+04 1.1500e+04 7.1500e+04 1.2500e+03
## [373] 4.0000e+08 4.2000e+07 1.8970e+07 2.1100e+07 9.9000e+06 1.7900e+07
## [379] 1.9500e+07 2.1300e+07 2.0100e+07 1.2710e+07 9.6000e+06 4.2310e+07
## [385] 4.3800e+06 7.1000e+04 3.0500e+06 6.7000e+05 6.9000e+04 7.8000e+05
## [391] 4.9000e+05 6.3500e+05 1.1600e+06 4.4000e+05 3.2400e+05 2.0300e+06
## [397] 6.3000e+03 1.1000e+02 1.2600e+07 2.8200e+06 5.6000e+05 2.7000e+07
## [403] 7.5100e+06 7.7000e+04 2.6500e+05 7.8740e+07 3.1500e+07 9.5000e+06
## [409] 4.5200e+06 2.4100e+06 4.1200e+06 2.1700e+04 1.6500e+07 3.3000e+04
## [415] 5.3000e+06 4.8000e+05 3.9500e+07 3.9000e+04 3.4000e+06 5.4000e+04
## [421] 4.1000e+05 6.4000e+04 2.3000e+06 6.0500e+07 1.7600e+06 1.7500e+03
## [427] 3.0300e+07 3.3000e+08 1.9000e+08 1.9000e+05 1.7500e+06 3.4500e+06
## [433] 2.1500e+05 9.4000e+05 1.7700e+07 3.1000e+06 1.1400e+05 1.2900e+07
## [439] 1.2800e+08 5.2500e+05 2.1400e+05 1.4000e+07 2.9500e+06 1.7500e+04
## [445] 2.7500e+06 5.3600e+05 2.2500e+03 4.9000e+04 1.0400e+06 7.8000e+03
## [451] 1.2600e+05 2.5500e+06 2.9708e+05 8.8150e+04 5.5600e+04 2.0700e+05
## [457] 1.5200e+04 1.8500e+06 1.1850e+07 8.4500e+06 8.5000e+07 2.4500e+06
## [463] 3.5000e+07 5.0800e+06 5.0500e+06 2.8500e+07 9.7600e+06 1.2500e+08
## [469] 1.3500e+04 6.9340e+05 2.0300e+05 2.5300e+05 3.7500e+04 7.9980e+04
## [475] 1.0002e+05 9.9000e+02 4.9980e+04 4.9600e+03 1.1800e+06 1.3500e+06
## [481] 9.0000e+07 2.2880e+04 1.6080e+05 6.0000e+08 5.7120e+04 8.8000e+04
## [487] 5.1000e+02 7.3000e+06 7.8000e+02 2.8000e+03 9.8000e+06 2.2500e+06
## [493] 2.6900e+05 1.0500e+06 5.6500e+07 1.0800e+05 6.4000e+08 5.4000e+07
## [499] 1.7800e+06 2.1900e+05 4.2600e+06 8.1000e+04 1.9600e+05 7.8000e+06
## [505] 1.0700e+05 7.2000e+04 1.8400e+05 4.2500e+05 1.6500e+05 5.5080e+07
## [511] 6.3000e+06 6.3200e+06 3.0400e+06 9.6000e+07 4.4720e+07 1.0200e+08
## [517] 3.0000e+09 4.6000e+04 5.4000e+05 5.5000e+02 9.5000e+03 5.1000e+03
## [523] 7.6600e+07 7.9000e+04 9.1700e+05 4.3000e+04 2.0500e+05 2.8600e+05
## [529] 1.4700e+05 2.4700e+04 1.0672e+05 4.7000e+06 6.6000e+02 1.2000e+02
## [535] 9.8260e+04 1.1000e+03 1.9790e+07 4.5000e+07 7.6000e+02 6.5500e+05
## [541] 5.8500e+05 7.0000e+07 4.2400e+04 4.2500e+06 3.8500e+05 7.7000e+05
## [547] 9.9000e+03 1.4900e+05 7.8700e+07 5.3800e+06 2.0400e+04 3.8850e+05
## [553] 1.5140e+05 1.5900e+05 9.1000e+04 8.0000e+07 5.0000e+08 1.0500e+08
## [559] 3.8200e+05 4.8000e+04 1.7416e+08 4.6800e+04 3.1000e+03 1.2500e+07
## [565] 1.3900e+07 2.0800e+07 4.2900e+06 8.8000e+05 2.9700e+07 3.5900e+07
## [571] 8.2000e+06 1.0300e+07 2.6200e+05 3.6500e+05 3.4800e+05 1.0600e+06
## [577] 8.7800e+07 1.7500e+08 1.1700e+05 6.4500e+05 2.5520e+07 4.3700e+05
## [583] 3.6700e+08 1.1300e+06 2.8400e+05 2.5500e+08 1.3500e+08 6.1980e+07
## [589] 1.6100e+08 3.8000e+07 4.3500e+05 8.8500e+04 5.1000e+04 3.1200e+05
## [595] 1.0200e+06 1.9500e+04 2.9960e+04 2.2990e+05 2.9988e+05 8.6500e+06
## [601] 8.9000e+03 3.0700e+07 1.7300e+07 2.5003e+05 1.4900e+06 8.2000e+04
## [607] 6.2500e+03 3.2500e+04 1.6500e+06 7.7500e+05 1.8000e+03 2.1800e+05
## [613] 3.1950e+07 5.1000e+08 3.0400e+08 3.1520e+07 3.0060e+07 3.4700e+05
## [619] 4.6300e+05 7.6600e+05 5.1500e+05 4.0200e+06 2.4210e+07 3.4630e+07
## [625] 1.1100e+06 1.2400e+06 8.6600e+04 4.9340e+07 3.7300e+05 5.0270e+05
## [631] 6.1000e+05 4.0500e+05 3.2500e+06 3.1500e+05 8.2500e+05 1.7000e+08
## [637] 4.5000e+08 9.2000e+06 1.7600e+07 8.5000e+02 7.2000e+07 6.0200e+08
## [643] 2.7800e+06 1.6600e+07 2.3300e+05 2.3700e+04 2.6870e+07 1.7030e+07
## [649] 2.6600e+06 1.8600e+06 1.0300e+04 7.4500e+05 2.1200e+05 2.5500e+05
## [655] 1.5400e+05 5.7500e+05 1.6100e+05 6.6000e+04 1.0003e+05 2.2180e+07
## [661] 4.8200e+05 6.4000e+06 2.6200e+07 1.3400e+07 3.0500e+05 5.3500e+05
## [667] 5.0500e+05 2.4500e+04 1.5500e+04 1.8500e+04 5.4100e+04 1.6500e+04
## [673] 9.7000e+04 1.9300e+05 4.1000e+07 9.9970e+04 3.6000e+05 4.1350e+05
## [679] 3.8300e+06 1.6600e+05 4.9992e+05 9.7000e+05 1.7200e+05 2.1000e+02
## [685] 1.5100e+03 1.6000e+07 3.7000e+06 6.8000e+04 2.8718e+08 6.6000e+07
## [691] 6.2000e+07 2.6800e+08 7.6000e+04 5.7500e+06 1.0100e+05 2.3550e+07
## [697] 5.5500e+06 6.6500e+04 2.3000e+03 4.6700e+05 9.1400e+05 3.6400e+06
## [703] 3.1300e+06 8.7500e+05 3.7100e+06 6.4200e+05 8.5700e+06 6.7000e+06
## [709] 3.4600e+06 1.9200e+07 5.7000e+04 9.5000e+05 8.4500e+05 1.6700e+05
## [715] 2.2140e+07 4.7400e+06 2.8500e+04 1.7200e+06 1.0360e+07 1.7000e+09
## [721] 3.4600e+05 2.4500e+05 3.7000e+05 2.0500e+06 2.2700e+05 6.6900e+07
## [727] 2.9000e+05 1.3300e+07 2.2200e+07 1.3800e+07 2.8000e+07 2.5130e+07
## [733] 4.1500e+06 2.2400e+05 5.9000e+06 6.1000e+07 2.6200e+08 1.3470e+07
## [739] 5.1000e+07 7.5800e+05 8.9000e+05 1.8600e+05 6.9000e+05 7.5500e+06
## [745] 9.4000e+04 1.5800e+06 2.7500e+04 1.5500e+06 2.4800e+06 8.2500e+04
## [751] 5.3000e+07 6.6800e+06 1.7840e+05 1.3860e+05 3.1500e+06 2.7800e+05
## [757] 2.6000e+06 5.4700e+05 1.7700e+06 9.6000e+05 9.2000e+04 2.7700e+06
## [763] 2.2500e+04 5.5000e+07 4.3172e+05 5.7045e+05 4.2000e+06 1.1500e+06
## [769] 1.7500e+07 3.5800e+08 1.7440e+05 2.7300e+06 3.7400e+06 5.0001e+05
## [775] 9.7500e+05 9.2000e+05 4.9996e+05 4.1062e+08 1.0900e+08 2.5800e+06
## [781] 5.9000e+05 1.0100e+06 8.2000e+07 3.2800e+05 9.1000e+05 5.6540e+04
## [787] 9.3200e+05 4.7100e+06 2.2000e+07 2.5200e+06 1.4700e+06 2.0020e+07
## [793] 2.9500e+05 4.7600e+05 2.3700e+05 7.3800e+05 7.2700e+07 7.4000e+04
## [799] 6.5100e+03 9.9000e+05 1.1100e+07 1.1500e+03 7.7200e+06 9.9390e+07
## [805] 6.1700e+05 1.5300e+05 8.7000e+05 6.5400e+05 6.7000e+04 1.2200e+05
## [811] 1.0200e+05 1.4800e+05 9.1000e+07 7.7000e+06 8.3000e+04 3.6000e+08
## [817] 1.6500e+08 7.8200e+04 2.2700e+07 6.6200e+05 5.4700e+08 6.6500e+05
## [823] 4.8020e+07 4.7300e+04 6.2500e+05 7.5300e+04 1.3002e+05 1.2700e+06
## [829] 9.2500e+05 7.1000e+07 7.6300e+04 6.4000e+07 6.5000e+07 1.0600e+08
## [835] 1.2700e+05 2.3500e+05 2.7100e+05 3.7800e+05 3.4300e+05 6.0700e+06
## [841] 7.5500e+05 2.0020e+04 2.8500e+05 8.4300e+06 8.4000e+04 3.3100e+06
## [847] 1.5000e+09 1.6650e+08 1.8300e+05 5.5700e+05 3.6300e+05 1.1100e+05
## [853] 5.0200e+05 5.9000e+04 9.6000e+04 4.6500e+07 1.5100e+05 1.0300e+05
## [859] 1.4600e+04 4.4300e+06 7.4250e+07 1.8800e+06 5.0040e+05 5.1007e+05
## [865] 1.1600e+05 5.0800e+05 1.2300e+08 2.2900e+05 4.6500e+05 1.4400e+04
## [871] 2.9000e+03 4.5700e+06 1.0400e+07 3.2200e+07 4.6000e+07 9.2500e+06
## [877] 9.6800e+04 5.8300e+05 6.0500e+06 1.5300e+06 6.8200e+06 1.7950e+05
## [883] 1.5355e+05 7.8700e+05 5.0100e+05 5.6500e+05 7.7780e+05 6.0600e+06
## [889] 1.4400e+05 7.0500e+06 6.1000e+06 4.9000e+07 6.0600e+05 2.7900e+05
## [895] 1.6900e+07 1.4600e+06 3.7000e+07 9.3600e+05 3.8250e+05 1.6050e+04
## [901] 4.6500e+06 1.9500e+06 4.2000e+05 1.7300e+05 4.3000e+07 2.2700e+06
## [907] 1.7140e+07 5.4800e+05 2.0900e+05 1.1200e+05 8.4000e+06 3.2220e+05
## [913] 1.3400e+05 1.5750e+04 9.5500e+05 3.0000e+08 3.5400e+05 5.0020e+04
## [919] 1.4800e+06 1.1300e+08 3.9000e+05 8.1500e+05 5.8600e+05 6.0400e+05
## [925] 3.5700e+06 1.7900e+06 7.6000e+05 1.0050e+05 1.4650e+05 2.5500e+04
## [931] 1.4985e+05 3.3500e+07 1.2800e+06 7.8500e+05 2.1300e+05 1.3700e+06
## [937] 2.6600e+05 5.1500e+09 3.7500e+06 7.1300e+05 7.2000e+03 4.7000e+07
## [943] 8.8800e+05 1.1600e+04 6.4500e+06 7.4500e+06 4.0600e+06 1.3800e+06
## [949] 6.5500e+04 5.6000e+06 9.8800e+05 2.1600e+06 1.0050e+07 3.6800e+06
## [955] 8.3000e+05 3.7800e+06 1.4300e+07 4.5700e+07 1.2700e+07 1.5300e+07
## [961] 3.9600e+06 1.5800e+05 1.1180e+07 1.1020e+07 1.4200e+05 1.1650e+07
## [967] 4.8500e+05 3.0800e+05 5.7400e+06 3.1500e+04 5.5400e+05 7.6200e+05
## [973] 1.5100e+06 9.5100e+06 2.0200e+05 3.8100e+05 4.5000e+02 9.3000e+04
## [979] 2.6500e+07 5.7600e+06 5.7000e+03 1.5600e+04 1.0863e+08 1.4958e+08
## [985] 3.6800e+08 1.1400e+08 8.2000e+05 1.8540e+07 1.3250e+04 1.3360e+07
## [991] 1.4260e+07 1.3800e+05 4.7900e+05 5.9400e+06 6.7500e+06 9.9000e+07
## [997] 9.7100e+05 8.8500e+06 1.6100e+06 3.5500e+06 4.5500e+07 5.8000e+05
## [1003] 6.8000e+06 1.6200e+05 3.3500e+05 2.0100e+05 2.2000e+02 1.9000e+03
## [1009] 9.6800e+05 4.5900e+05 1.8900e+05 1.6200e+04 5.7700e+05 3.4500e+05
## [1015] 5.1000e+06 2.6100e+05 4.4500e+06 1.1150e+07 1.5500e+03 3.2800e+06
## [1021] 1.5900e+06 8.2400e+05 4.6056e+05 1.5400e+06 8.0677e+05 6.9640e+08
## [1027] 1.0400e+09 5.5220e+07 2.7860e+08 1.6960e+07 2.1500e+07 3.2400e+06
## [1033] 9.7900e+05 1.6100e+07 1.7750e+07 3.3700e+05 9.1700e+06 9.3500e+05
## [1039] 1.7900e+05 2.7500e+03 2.5700e+05 4.1600e+07 6.4515e+08 3.9600e+04
## [1045] 1.1020e+04 1.5500e+07 2.4600e+05 1.3400e+06 2.6300e+07 1.9640e+07
## [1051] 2.3500e+06 5.2400e+06 2.4600e+06 5.3047e+08 1.8100e+06 1.6111e+08
## [1057] 6.5000e+02 2.1200e+07 2.7500e+07 1.4700e+07 1.3790e+05 7.2500e+05
## [1063] 1.2900e+06 1.0500e+03 4.3000e+05 2.6500e+06 2.8550e+07 1.6900e+06
## [1069] 9.5400e+05 7.1000e+05 4.3560e+08 7.2900e+06 5.3400e+05 1.3300e+06
## [1075] 6.2500e+06 2.3200e+06 5.2000e+07 4.1500e+03 2.1000e+08 1.6000e+08
## [1081] 3.5400e+06 3.2220e+07 1.8050e+07 9.5000e+02 4.9300e+05 2.0600e+05
## [1087] 1.4100e+05 1.8500e+03 2.8100e+06 3.9200e+06 1.1620e+07 5.5800e+06
## [1093] 1.3950e+07 2.3230e+07 1.6740e+07 9.3100e+06 1.1160e+07 4.2200e+06
## [1099] 8.3700e+06 2.8300e+05 2.0500e+03 3.3000e+07 1.0880e+07 1.9770e+04
## [1105] 2.1880e+07 1.4500e+06 8.8700e+06 3.0200e+06 5.0600e+08 4.5070e+07
## [1111] 5.5100e+07 1.8200e+06 1.6870e+07 4.8600e+06 4.4500e+04 8.6000e+06
## [1117] 1.3530e+07 1.2050e+07 5.1500e+04 3.4000e+05 1.0400e+05 1.9900e+07
## [1123] 1.2200e+07 1.9200e+06 8.0900e+06 1.6350e+05 1.7700e+05 1.4650e+08
## [1129] 2.6000e+03 1.4300e+05 5.4200e+09 9.2900e+08 7.8000e+07 1.3000e+09
## [1135] 6.2100e+08 4.8300e+09 2.3500e+07 1.2720e+08 1.7940e+08 1.7400e+06
## [1141] 4.0000e+09 9.0430e+07 3.7990e+08 3.2300e+08 7.0200e+08 1.3480e+08
## [1147] 2.5300e+06 2.1900e+06 6.1300e+05 5.5100e+06 1.4280e+07 3.2700e+05
## [1153] 5.4200e+06 2.2200e+06 7.5825e+05 6.6100e+05 2.4200e+05 3.5300e+06
## [1159] 1.4300e+06 9.7200e+04 1.3600e+05 1.1830e+07 3.5500e+05 1.6250e+04
## [1165] 6.6700e+06 1.2300e+06 6.6300e+06 1.0430e+07 1.0500e+07 4.5100e+06
## [1171] 4.1700e+06 3.1100e+06 1.0300e+06 2.3600e+06 1.2400e+07 8.1000e+06
## [1177] 2.5500e+07 2.4300e+05 6.0500e+05 5.4900e+07 4.5100e+05 1.9300e+07
## [1183] 1.0150e+07 3.0500e+04 4.9940e+04 2.7700e+05 5.1300e+06 6.1400e+06
## [1189] 4.7800e+05 5.9000e+03 2.3200e+07 8.1000e+02 1.0250e+04 3.5900e+05
## [1195] 2.5700e+06 7.0600e+05 4.3600e+04 8.2500e+03 5.3800e+07 4.3800e+05
## [1201] 3.6000e+07 1.4100e+06 3.5300e+05 3.5550e+07 8.7600e+05 9.1500e+05
## [1207] 3.2500e+03 6.8000e+07 1.7800e+05 3.4890e+07 2.6900e+06 2.3500e+04
## [1213] 3.8500e+04 2.0500e+07 1.9850e+05 8.6850e+05 5.5900e+07 6.0800e+07
## [1219] 1.0400e+08 1.7100e+06 1.1500e+08 1.0800e+08 7.1500e+06 6.9000e+06
## [1225] 1.0000e+10 1.0100e+08 1.3150e+07 1.4825e+05 9.7700e+06 9.3000e+05
## [1231] 3.9400e+06 2.7075e+05 1.6300e+05 2.4610e+05 5.0100e+04 9.5250e+05
## [1237] 1.6800e+05 1.2900e+04 1.1600e+07 1.1700e+07 7.4000e+05 2.5400e+06
## [1243] 4.8500e+06 2.8800e+05 4.7500e+07 1.6930e+10 3.1300e+10 4.3200e+08
## [1249] 5.9900e+06 6.4300e+05 4.4200e+05 5.4500e+05 1.3000e+08 4.4500e+05
## [1255] 7.3500e+09 1.1260e+10 5.8800e+09 1.0600e+03 7.4600e+05 7.0100e+05
## [1261] 7.6400e+06 9.7300e+05 7.2400e+05 9.4500e+05 1.6200e+07 2.5795e+05
## [1267] 1.9940e+04 1.7961e+05 7.9200e+04 1.2800e+04 4.2160e+07 8.3000e+06
## [1273] 9.3000e+07 1.2490e+08 8.9700e+06 1.7300e+06 3.6500e+06 2.2750e+04
## [1279] 1.6200e+06 3.4810e+05 1.6000e+02 8.6000e+04 1.6200e+03 1.0100e+03
## [1285] 8.7000e+04 2.0900e+09 1.5950e+08 1.3900e+05 5.1600e+06 5.9200e+05
## [1291] 4.0500e+04 3.4310e+07 1.7100e+05 4.0200e+04 7.7500e+03 4.1114e+05
## [1297] 2.8010e+05 5.3110e+05 1.7000e+02 1.1500e+11 9.7200e+06 3.5700e+05
## [1303] 1.3700e+05 2.4900e+05 1.2170e+05 4.1100e+05 1.5700e+06 3.4700e+06
## [1309] 1.8700e+06 1.4600e+05 9.9600e+05 1.3200e+06 1.0900e+05 5.5200e+05
## [1315] 2.5900e+05 1.6400e+05 5.2400e+05 6.2300e+05 5.2700e+06 1.0100e+07
## [1321] 6.3200e+05 8.8700e+05 1.1300e+05 2.9400e+05 9.0600e+06 6.6000e+05
## [1327] 9.9500e+05 2.4500e+07 3.2000e+08 8.6000e+02 6.9000e+07 1.0800e+07
## [1333] 4.9900e+07 9.4500e+04 8.9500e+04 3.6000e+03 3.6200e+07 1.8500e+07
## [1339] 2.8680e+07 5.6900e+05 1.9900e+06 4.4400e+06 4.3600e+06 2.3800e+06
## [1345] 3.1700e+06 6.3400e+06 1.2060e+04 5.4200e+05 3.1900e+04 3.1700e+04
## [1351] 3.1600e+04 1.5110e+08 1.1000e+08 2.1700e+07 7.6500e+04 2.0800e+05
## [1357] 9.8900e+05 1.2900e+05 4.3400e+05 3.7700e+05 1.4400e+06 1.5600e+06
## [1363] 3.3800e+05 4.8400e+06 2.1600e+07 8.1150e+07 1.8200e+07 3.7500e+07
## [1369] 3.1400e+05 2.9700e+05 4.7200e+05 4.1500e+04 6.1200e+05 9.7000e+03
## [1375] 6.2600e+07 1.2400e+05 1.8300e+07 2.0400e+07 5.5600e+05 7.7700e+06
## [1381] 1.3700e+08 8.2300e+05 7.3000e+03 1.6700e+04 1.9100e+06 1.1900e+07
## [1387] 2.8200e+07 1.3600e+06 2.6700e+06 7.7700e+05 1.5750e+07 2.2750e+07
## [1393] 2.9000e+07 2.3400e+05 2.4700e+03 1.4700e+08 3.6250e+04 4.4459e+05
## [1399] 4.3100e+05 6.7000e+07 5.7600e+05 1.8900e+06 2.0500e+04 1.2100e+05
## [1405] 1.6800e+07 2.2600e+05 6.8400e+05 7.5000e+08 9.7500e+03 1.9400e+04
## [1411] 2.6300e+06 2.0200e+07 3.7500e+03 2.2850e+04 9.4000e+06 6.7400e+06
## [1417] 3.7040e+05 3.6650e+05 7.2700e+05 4.8100e+05 2.7400e+05 9.5700e+05
## [1423] 2.4280e+05 6.3900e+05 5.8100e+05 2.9100e+05 4.9300e+06 2.8400e+07
## [1429] 1.0690e+07 7.1000e+06 5.8000e+03 2.2600e+07 4.1700e+07 2.3700e+07
## [1435] 9.6600e+07 1.6700e+07 6.3700e+07 1.2870e+08 1.8400e+07 8.9000e+06
## [1441] 1.4100e+07 1.5650e+05 4.9400e+06 6.9100e+05 6.8600e+05 1.3710e+07
## [1447] 7.9300e+06 8.7500e+06 6.5700e+06 4.2900e+05 4.6400e+06 1.0222e+08
## [1453] 6.2990e+07 1.9700e+06 7.7970e+07 1.5660e+07 4.6200e+05 2.1500e+06
## [1459] 2.2400e+07 5.2560e+05 2.8300e+03 4.6216e+05 1.3500e+03 4.0230e+05
## [1465] 1.8600e+07 1.3540e+07 4.5300e+05 1.3200e+07 1.5700e+05 4.4100e+06
## [1471] 7.4800e+05 2.6400e+05 5.5300e+05 6.0300e+05 2.6800e+05 3.4200e+05
## [1477] 5.5800e+05 1.4800e+04 1.5200e+05 6.1900e+05 1.9100e+05 1.6120e+08
## [1483] 5.5500e+05 1.2300e+05 2.1600e+05 4.8800e+05 1.6667e+05 1.7750e+05
## [1489] 8.1300e+05 6.8600e+07 4.9500e+04 7.1500e+05 5.2500e+04 9.0160e+05
## [1495] 7.0000e+08 1.6750e+05 1.3130e+07 1.2290e+07 2.5200e+05 3.8500e+03
## [1501] 3.5500e+04 1.2170e+07 2.2200e+05 3.2100e+05 3.5000e+08 9.6400e+05
## [1507] 3.9750e+05 1.3200e+03 1.1400e+07 8.1000e+07 7.4400e+06 4.5500e+05
## [1513] 4.4520e+07 5.6300e+06 3.1800e+06 2.1750e+07 8.4800e+06 1.0440e+07
## [1519] 5.8500e+06 1.1700e+06 5.5200e+06 3.6200e+05 2.4100e+05 1.7920e+07
## [1525] 3.3300e+03 1.1900e+05 1.3670e+04 3.2700e+06 1.6150e+07 1.0700e+07
## [1531] 2.6430e+07 1.1790e+07 2.3580e+07 2.5650e+07 4.0500e+06 8.0700e+06
## [1537] 7.0900e+04 2.4760e+07 2.6640e+07 5.9100e+06 3.5200e+06 8.3200e+06
## [1543] 1.6640e+07 3.4900e+05 8.8100e+06 8.6800e+05 5.9800e+05 2.3200e+05
## [1549] 9.7500e+06 8.5900e+05 1.1300e+07 7.7800e+04 2.8900e+07 3.9500e+06
## [1555] 3.3400e+03 1.1250e+05 2.9500e+04 2.5800e+05 1.6500e+03 1.5020e+05
## [1561] 5.5500e+04 2.0600e+07 4.7500e+04 2.1100e+05 2.5338e+08 8.9200e+05
## [1567] 4.3370e+05 3.2500e+07 5.6400e+06 5.7500e+03 2.4100e+07 2.7200e+05
## [1573] 2.5740e+05 5.3000e+03 2.9730e+05 9.3430e+05 2.0900e+04 4.2300e+05
## [1579] 3.0300e+06 4.5900e+06 3.2900e+06 2.1700e+08 7.6400e+03 4.0200e+05
## [1585] 1.7200e+07 1.6300e+06 1.8000e+09 9.0000e+08 6.6100e+06 4.1800e+05
## [1591] 9.7000e+07 1.9700e+07 1.1700e+04 1.9600e+06 3.0900e+05 3.8100e+06
## [1597] 1.8200e+05 2.9670e+05 2.5900e+04 6.5300e+06 1.0600e+07 2.2600e+06
## [1603] 2.6700e+05 3.7000e+03 1.1900e+06 8.5500e+05 1.5840e+06 3.3300e+05
## [1609] 2.6600e+07 5.7000e+07 2.6250e+05 7.6700e+05 4.2600e+05 1.2100e+06
## [1615] 6.8500e+05 1.6600e+06 5.5750e+05 1.0900e+07 2.4700e+06 4.7500e+03
## [1621] 4.3700e+06 6.4390e+05 6.7600e+05 1.0800e+06 3.8500e+07 3.5600e+06
## [1627] 1.1200e+07 2.8200e+05 6.8800e+06 2.9800e+06 3.9100e+06 1.2200e+08
## [1633] 5.7200e+05 4.2700e+06 2.0700e+06 1.8300e+06 8.3800e+04 7.0600e+06
## [1639] 4.5800e+04 3.4800e+06 8.8750e+04 3.7100e+05 8.6500e+05 7.3000e+05
## [1645] 1.3300e+03 4.5800e+05 6.1500e+05 1.5250e+04 3.9800e+04 1.3400e+03
## [1651] 3.9900e+06 1.4100e+04 2.2800e+06 2.8000e+09 6.8800e+05 1.5200e+07
## [1657] 7.1600e+05 1.6600e+08 7.5200e+05 2.0000e+09 3.9000e+03 2.7200e+03
## [1663] 4.8000e+03 2.7600e+05 3.1100e+05 6.6700e+05 5.3900e+04 2.2760e+08
## [1669] 5.8000e+07 4.6100e+05 9.4000e+03 3.5150e+05 2.7100e+04 4.0300e+04
## [1675] 6.9700e+04 1.6480e+08 4.2500e+03 1.8100e+05 3.0900e+08 4.3500e+07
## [1681] 1.3200e+04
##Check the values of CROPDMGEXP column in stormred data by listing the values
unique(stormred$CROPDMGEXP)
## [1] "" "M" "K" "m" "B" "?" "0" "k" "2"
## Assigning the values for crop damage exponent of stormred data
stormred$CROPEXP[stormred$CROPDMGEXP=="M"]<-1000000
stormred$CROPEXP[stormred$CROPDMGEXP=="K"]<-1000
stormred$CROPEXP[stormred$CROPDMGEXP=="m"]<-1000000
stormred$CROPEXP[stormred$CROPDMGEXP=="B"]<-1000000000
stormred$CROPEXP[stormred$CROPDMGEXP=="0"]<-1
stormred$CROPEXP[stormred$CROPDMGEXP=="k"]<-1000
stormred$CROPEXP[stormred$CROPDMGEXP=="2"]<-100
stormred$CROPEXP[stormred$CROPDMGEXP==""]<-1
stormred$CROPEXP[stormred$CROPDMGEXP=="?"]<-0
## Calculating the total crop damage value by multiplying the crop damage and crop exponent value
stormred$CROPDMGVAL<- stormred$CROPDMG*stormred$CROPEXP
## Checking the unique values in the specified column by listing out the values
unique(stormred$CROPDMGVAL)
## [1] 0 10000000 500000 1000000 4000000 50000
## [7] 5000 15000 500 10000 5000000 50000000
## [13] 400000000 50 21000000 7000000 17000000 26000000
## [19] 22000000 3000000 800000 39000000 20000000 300000000
## [25] 900000 48000000 200000 1500000 2500 3000
## [31] 2000 25000000 130000000 37000000 20000 2500000
## [37] 25000 15000000 9000000 45000000 1000 20
## [43] 185000 5000000000 35000 2200 12000000 300
## [49] 90000 150000 9000 100000 7000 500000000
## [55] 66000000 142000000 1100000 700000 4000 5
## [61] 330000 750000 6000 43000 60000 1800000
## [67] 250000 40000 12000 22000 1300000 25
## [73] 200000000 30000 60 70000 80000 350000
## [79] 400000 8000 75000 45000 300000 200
## [85] 3500000 63000 18000 280 150 100
## [91] 1700 750 700 4700000 16000000 6000000
## [97] 2000000 3500 800 170000 600000 125000
## [103] 6700000 2200000 2100000 675000 600 262000000
## [109] 332000 220000 56000 3 30000000 18000000
## [115] 4 1500 353000 177000 36000000 1700000
## [121] 373000 430000 160000 123000 13000000 140000
## [127] 38000 52000000 240 320000 7700000 3700000
## [133] 6800000 1200000 380000 6500000 5600 74900000
## [139] 34100000 15300000 24000000 5100000 8000000 27000000
## [145] 42000000 650000 130000 230000 10500000 55000
## [151] 1580000 5990000 1250000 3600000 5200000 3250
## [157] 5250000 3220000 204000 2400000 127000000 7500000
## [163] 46000000 33000000 120000 2250000 19800000 4500000
## [169] 40000000 189680000 1050000 81000 225000 37500
## [175] 5400000 7550000 1400000 26840000 5700000 500100
## [181] 950000 56000000 15700000 11000000 17500000 110000
## [187] 1120000 55700000 1600000 12900000 20040000 46500000
## [193] 65000000 4800 1480000 43680000 613000 14000000
## [199] 19000 3400000 850000 450000 240000 36000
## [205] 1270000 17000 16000 2800000 34480 13400000
## [211] 11000 14000 23000 17960000 26000 63770000
## [217] 9380000 12400000 9900 1210000 12500 24000
## [223] 100000000 7800000 159000 242000 280000 14100000
## [229] 4200000 6900000 4970000 540000 713000 7200000
## [235] 5900000 73600000 7100000 10200000 5300000 17100000
## [241] 596000000 74300000 470000 27000 35000000 655000
## [247] 460000 180000 400 2900 1600 1300
## [253] 260100 145000 5500000 3800000 1750000 978000
## [259] 137900000 77480000 17500 28000 41500 190000
## [265] 900 2800 250 6210000 68000 21000
## [271] 11700 65000 85000 117000000 64000000 6100000
## [277] 2600000 4500 97000 3750000 150000000 150200000
## [283] 167900000 135000000 1550000 450000000 250000000 11500
## [289] 3110000 38800000 550000 80000000 310000 186000
## [295] 13000 33000 66000 88000 105000 1770000
## [301] 149700 301000000 4660000 39000 22700 3390000
## [307] 15650000 131010000 8800000 29100000 475000 338000000
## [313] 12300000 8300000 11800000 875000 2700000 465000
## [319] 109920000 7500 154000000 575000 660000 39850000
## [325] 413600000 63400000 12500000 20300000 4910000 640000
## [331] 22600000 83000000 6700 41660000 42300000 420000
## [337] 61000 865000 306720000 210000 13500 325000
## [343] 975000 150080000 160960000 60000000 1850000 169600000
## [349] 80850000 8500 29000000 52000 240000000 605000
## [355] 399840000 44000 32000 29000 85000000 175000
## [361] 1900000 102300000 515000000 1560000 8400000 151000
## [367] 31900000 10450000 19000000 3250000 1960000 6030000
## [373] 6850000 78000000 1650000 578850000 25010000 420000000
## [379] 70000000 10 24270000 256000 6630 53000000
## [385] 115000 4400000 510000 168000000 480000000 25200000
## [391] 65050000 24500 4430000 275000 28000000 8900000
## [397] 13200000 9600000 7810000 10800000 8500000 1930000
## [403] 43000000 312480000 261000 270000 4810000 8550000
## [409] 156500 335000 14250000 10920000 7140000 1330000
## [415] 11960000 5500 290000 1250 31000000 1800
## [421] 285000000 175000000 90000000 93200000 82500000 8700000
## [427] 48400000 26500000 15200000 21600 4600000 21600000
## [433] 500800 990000 2850000 11500000 576000 920000
## [439] 890000 216000000 101500000 49000 47000 190000000
## [445] 21940000 671000 8600000 32500000 423000000 66500000
## [451] 26360000 180110000 48460000 10190000 1350000 154690000
## [457] 630000 42650000 1470000 415000 49000000 5800000
## [463] 2150000 1510000000 2330000 2650000 8490000 11680000
## [469] 34500000 113900 83000 22320000 230000000 120000000
## [475] 193900 11940000 112500 16600000 9100000 492400000
## [481] 77000000 15100000 2300000 76500 22200000 985000
## [487] 151000000 1000000000 45400000 2400 9400000 4160000
## [493] 26320000 5920000 2470000 73000000 155000000 344000000
## [499] 620000 390000 316000 153000 523000 67000
## [505] 387000 243000 213000 610000 99000 155000
## [511] 625000 133000 169000 588000 512000 375000
## [517] 31000 105000000 480000 55000000 112000 425000
## [523] 286000000 42000 281000 165000 107000 91000
## [529] 41000000
## Aggregating the property damage value by event type and sorting out in a descending order
prop<- aggregate(PROPDMGVAL~EVTYPE, data=stormred, FUN=sum, na.rm=TRUE)
prop<- prop[with(prop,order(-PROPDMGVAL)),]
## Limiting the data to the top 10 rows of the property damage value
prop<- head(prop,10)
## Aggregating the crop damage value by event type and sorting out in a descending order
crop<- aggregate(CROPDMGVAL~EVTYPE, data=stormred, FUN=sum, na.rm=TRUE)
crop<- crop[with(crop,order(-CROPDMGVAL)),]
## Limiting the data to the top 10 rows of the crop damage value
crop<- head(crop,10)
## Aggregating the total economic damage by binding the columns of property and crop damage values
Economicdata<- aggregate(cbind(PROPDMGVAL, CROPDMGVAL)~EVTYPE, data=stormred, FUN=sum, na.rm=TRUE)
## Adding the values of both the columns and storing the values in the new column called ecoloss
Economicdata$ecoloss<- Economicdata$PROPDMGVAL+Economicdata$CROPDMGVAL
## Sorting the columns in descending order based on the event type
Economicdata<- Economicdata[order(Economicdata$ecoloss, decreasing=TRUE),]
## Subsetting the top 10 rows of the total economic damage
top10ecodmg<- Economicdata[1:10,]
RESULTS
Looking at the data and Plotting the obtained results from the data processing for Q1.
## Look at the data stored in 'top10fatalities'
top10fatalities
## EVTYPE FATALITIES
## 834 TORNADO 5633
## 130 EXCESSIVE HEAT 1903
## 153 FLASH FLOOD 978
## 275 HEAT 937
## 464 LIGHTNING 816
## 856 TSTM WIND 504
## 170 FLOOD 470
## 585 RIP CURRENT 368
## 359 HIGH WIND 248
## 19 AVALANCHE 224
## Look at the data stored in 'top10injuries'
top10injuries
## EVTYPE INJURIES
## 834 TORNADO 91346
## 856 TSTM WIND 6957
## 170 FLOOD 6789
## 130 EXCESSIVE HEAT 6525
## 464 LIGHTNING 5230
## 275 HEAT 2100
## 427 ICE STORM 1975
## 153 FLASH FLOOD 1777
## 760 THUNDERSTORM WIND 1488
## 244 HAIL 1361
## Look at data stored in 'top10pophealth'
top10pophealth
## EVTYPE FATALITIES INJURIES loss
## 1 TORNADO 5633 91346 96979
## 2 EXCESSIVE HEAT 1903 6525 8428
## 3 TSTM WIND 504 6957 7461
## 4 FLOOD 470 6789 7259
## 5 LIGHTNING 816 5230 6046
## 6 HEAT 937 2100 3037
## 7 FLASH FLOOD 978 1777 2755
## 8 ICE STORM 89 1975 2064
## 9 THUNDERSTORM WIND 133 1488 1621
## 10 WINTER STORM 206 1321 1527
## Create a panel plot showing the graphs for top 10 fatalities and injuries each.
## Set the panel plot margins as follows
par(mfrow=c(1,3), mar=c(10,6,3,1))
## Create a bar plot for top 10 fatalities
barplot(top10fatalities$FATALITIES, names.arg=top10fatalities$EVTYPE, las=2, col="red", ylab="fatalities", main="Top 10 Fatalities")
## Create a barplot for top 10 injuries
barplot(top10injuries$INJURIES, names.arg=top10injuries$EVTYPE, las=2, col="gold", ylab="injuries", main="Top 10 Injuries")
## Create a barplot for top 10 reasons for population health loss
barplot(top10pophealth$loss, names.arg=top10pophealth$EVTYPE, las=2, col=c("purple"), ylab="fatalities+injuries", main="Total population health loss")

According to the first plot, highest number of fatalities have been caused due to tornadoes. Highest number of injuries also have been caused by tornadoes. The total impact on the population health, that is, including both fatalities and injuries is also caused by tornadoes in the US.
Looking at the data and Plotting the obtained results from the data processing for Q2.
## Print the contents of prop
print(prop)
## EVTYPE PROPDMGVAL
## 170 FLOOD 144657709807
## 411 HURRICANE/TYPHOON 69305840000
## 834 TORNADO 56947380617
## 670 STORM SURGE 43323536000
## 153 FLASH FLOOD 16822673979
## 244 HAIL 15735267513
## 402 HURRICANE 11868319010
## 848 TROPICAL STORM 7703890550
## 972 WINTER STORM 6688497251
## 359 HIGH WIND 5270046260
## Print the contents of crop
print(crop)
## EVTYPE CROPDMGVAL
## 95 DROUGHT 13972566000
## 170 FLOOD 5661968450
## 590 RIVER FLOOD 5029459000
## 427 ICE STORM 5022113500
## 244 HAIL 3025954473
## 402 HURRICANE 2741910000
## 411 HURRICANE/TYPHOON 2607872800
## 153 FLASH FLOOD 1421317100
## 140 EXTREME COLD 1292973000
## 212 FROST/FREEZE 1094086000
## Print the contents of top10ecodmg (top 10 reasons for total economic damages)
print(top10ecodmg)
## EVTYPE PROPDMGVAL CROPDMGVAL ecoloss
## 170 FLOOD 144657709807 5661968450 150319678257
## 411 HURRICANE/TYPHOON 69305840000 2607872800 71913712800
## 834 TORNADO 56947380617 414953270 57362333887
## 670 STORM SURGE 43323536000 5000 43323541000
## 244 HAIL 15735267513 3025954473 18761221986
## 153 FLASH FLOOD 16822673979 1421317100 18243991079
## 95 DROUGHT 1046106000 13972566000 15018672000
## 402 HURRICANE 11868319010 2741910000 14610229010
## 590 RIVER FLOOD 5118945500 5029459000 10148404500
## 427 ICE STORM 3944927860 5022113500 8967041360
## Plot the graphs in a panel plot with specified margins
par(mfrow=c(1,3), mar=c(11,6,3,2))
## Plot the graph for property damages
barplot(prop$PROPDMGVAL/(10^9),names.arg=prop$EVTYPE,las=2,col="blue",ylab="Property damage(billions)",main="Top10 Property Damages")
## Plot the graph for crop damages
barplot(crop$CROPDMGVAL/(10^9),names.arg=crop$EVTYPE,las=2,col="green",ylab="Crop damage(billions)",main="Top10 Crop Damages")
## Plot the graph for total economic damages
barplot(top10ecodmg$ecoloss/(10^9),names.arg=top10ecodmg$EVTYPE,las=2,col="yellow",ylab="Economic damage(billions)",main="Total Economic Damages")

According to the plot, the highest amount of property damages were caused due to floods and highest amount of crop damages are due to droughts. The highest total amount of economic damage is also caused due to floods.