As many have observed in recent years, storms and other severe weather events cause both public health and economic problems for communities and municipalities as it often results in fatalities, injuries, and property damage.
The purpose of this report is to identify which of these storms and other severe weather events are a key concern. More precisely, this report will attempt to answer the 2 following questions: 1) Across the United States, which types of events are most harmful with respect to population health? 2) Across the United States, which types of events have the greatest economic consequences?
This project uses the U.S. National Oceanic and Atmospheric Administration’s (NOAA) storm database - a database that tracks the characteristics of major storms and weather events in the United States, including when and where they occur, as well as estimates of any fatalities, injuries, property damage and crop damage.
For the purpose of this report, we use the sum of fatalities and injuries occurring during events, without any attempt to quantify the value of a fatality compared to an injury, to analyse the impact of events with respect to population health . We use the sum of property damage and crop damage to quantify events that have the greatest economic consequences.
Focusing on recent years (1993 to 2011), the top 4 events the are most harmful with respect to population health are tornadoes, excessive heat, flood and thunderstorm wind while the top 4 events that have the greatest economic consequences are flood, hurricane, tide and tornadoes. While addressing the issues contributing to climate change would help reducing the human and economic impact of those severe events, finding solutions to address the impact of flood (both from a human and economic perspective) might is a good place to start acting now.
The data come in the form of a comma-separated-value file compressed via the bzip2 algorithm. Documentation of the database is available from here while FAQ is available from here.
The events in the database start in the year 1950 and end in November 2011. In the earlier years of the database there are generally fewer events recorded, most likely due to a lack of good records. More recent years should be considered more complete.
A quick look at the data reveals that the quality of the data is poor with many events entries not respecting the guidelines presented in the documentation. As such, once the data of the event has been converted to POSIXct format in order to identify recent events, work is done to clean the event indicated in the EVTYPE variable.
This is section setup the libraries and the folder to read data.
## Cleaning Global Environment fisrt
rm(list = ls())
## library to use
library(data.table)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.4 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::between() masks data.table::between()
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::first() masks data.table::first()
## ✖ lubridate::hour() masks data.table::hour()
## ✖ lubridate::isoweek() masks data.table::isoweek()
## ✖ dplyr::lag() masks stats::lag()
## ✖ dplyr::last() masks data.table::last()
## ✖ lubridate::mday() masks data.table::mday()
## ✖ lubridate::minute() masks data.table::minute()
## ✖ lubridate::month() masks data.table::month()
## ✖ lubridate::quarter() masks data.table::quarter()
## ✖ lubridate::second() masks data.table::second()
## ✖ purrr::transpose() masks data.table::transpose()
## ✖ lubridate::wday() masks data.table::wday()
## ✖ lubridate::week() masks data.table::week()
## ✖ lubridate::yday() masks data.table::yday()
## ✖ lubridate::year() masks data.table::year()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ggplot2)
library(gridExtra)
##
## Attachement du package : 'gridExtra'
##
## L'objet suivant est masqué depuis 'package:dplyr':
##
## combine
library(lubridate)
## Setting data folder (working locally)
## simple paste widows copied link into r"( )"
data.dir <- r"(F:\Jeff et Sara\Documents\R\reproducible-research-course-project-2\data\)"
data.dir <- gsub("\\\\", "/", data.dir)
If security protocol does not allow for downloading the data with R, download maually to data folder.
## If protocol allows...
file <- "https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2"
download.file(file,paste0(data.dir, "repdata_data_StormData.csv.bz2"))
## In download.file(file, paste0(data.dir, "repdata_data_StormData.csv.bz2")) : cannot open URL 'https://d396qusza40orc.cloudfront.net/repdata_data_StormData.csv.bz2': HTTP status was '403 Forbidden'
## Data was downloaded manually to data.dir
## Loading and processing the data
data <- as.data.table(read.csv(bzfile(paste0(data.dir, "repdata_data_StormData.csv.bz2")), header = T))
## looking at data
head(data)
## STATE__ BGN_DATE BGN_TIME TIME_ZONE COUNTY COUNTYNAME STATE
## <num> <char> <char> <char> <num> <char> <char>
## 1: 1 4/18/1950 0:00:00 0130 CST 97 MOBILE AL
## 2: 1 4/18/1950 0:00:00 0145 CST 3 BALDWIN AL
## 3: 1 2/20/1951 0:00:00 1600 CST 57 FAYETTE AL
## 4: 1 6/8/1951 0:00:00 0900 CST 89 MADISON AL
## 5: 1 11/15/1951 0:00:00 1500 CST 43 CULLMAN AL
## 6: 1 11/15/1951 0:00:00 2000 CST 77 LAUDERDALE AL
## EVTYPE BGN_RANGE BGN_AZI BGN_LOCATI END_DATE END_TIME COUNTY_END COUNTYENDN
## <char> <num> <char> <char> <char> <char> <num> <lgcl>
## 1: TORNADO 0 0 NA
## 2: TORNADO 0 0 NA
## 3: TORNADO 0 0 NA
## 4: TORNADO 0 0 NA
## 5: TORNADO 0 0 NA
## 6: TORNADO 0 0 NA
## END_RANGE END_AZI END_LOCATI LENGTH WIDTH F MAG FATALITIES INJURIES
## <num> <char> <char> <num> <num> <int> <num> <num> <num>
## 1: 0 14.0 100 3 0 0 15
## 2: 0 2.0 150 2 0 0 0
## 3: 0 0.1 123 2 0 0 2
## 4: 0 0.0 100 2 0 0 2
## 5: 0 0.0 150 2 0 0 2
## 6: 0 1.5 177 2 0 0 6
## PROPDMG PROPDMGEXP CROPDMG CROPDMGEXP WFO STATEOFFIC ZONENAMES LATITUDE
## <num> <char> <num> <char> <char> <char> <char> <num>
## 1: 25.0 K 0 3040
## 2: 2.5 K 0 3042
## 3: 25.0 K 0 3340
## 4: 2.5 K 0 3458
## 5: 2.5 K 0 3412
## 6: 2.5 K 0 3450
## LONGITUDE LATITUDE_E LONGITUDE_ REMARKS REFNUM
## <num> <num> <num> <char> <num>
## 1: 8812 3051 8806 1
## 2: 8755 0 0 2
## 3: 8742 0 0 3
## 4: 8626 0 0 4
## 5: 8642 0 0 5
## 6: 8748 0 0 6
str(data)
## Classes 'data.table' and '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 ...
## - attr(*, ".internal.selfref")=<externalptr>
## Getting variables names
var_names <- names(data)
Multiple issues were encountered with the BGN_TIME variable, including inconsistent format and some observation had “o” instead of “0”. This section adress those issues to be able to keep years from 1993 to 2011 (later in code).
## There are multiple problems with BGN_TIME variable... including inconsistent format
## some observations has o instead of 0
data[, BGN_TIME := gsub("[Oo]","0",BGN_TIME)]
## if the length is only 4 then will extract info and recreate BGN_TIME
data[nchar(BGN_TIME) == 4, `:=` (hour = as.numeric(substr(BGN_TIME, start = 1, stop = 2)), min = as.numeric(substr(BGN_TIME, start = 3, stop = 4)))]
## if the length is only 3 then will extract info and recreate BGN_TIME
data[nchar(BGN_TIME) == 3, `:=` (hour = as.numeric(substr(BGN_TIME, start = 1, stop = 1)), min = as.numeric(substr(BGN_TIME, start = 2, stop = 3)))]
## There are some observations with minutes above 60 - will convert
data[min >= 60, `:=` (hour = hour + 1, min = min - 60)]
## one obs is really weird... set to 0
data[hour > 24, `:=` (min = 0, hour = 0)]
data[hour <= 11, daytime := "AM"][hour >= 12, daytime := "PM"][hour >= 12, hour := hour - 12]
data[,hour := as.character(hour)][!is.na(hour) & nchar(hour) == 1, hour := paste0("0",hour)]
data[,min := as.character(min)][!is.na(min) & nchar(min) == 1, min := paste0("0",min)]
data[nchar(BGN_TIME) <= 4, BGN_TIME := paste0(hour,":", min,":00 ",daytime)]
data[, beginning_time := hms(BGN_TIME)]
data[, time_event := mdy_hms(BGN_DATE) + beginning_time]
data[,year := year(time_event)]
Once the year of the event is correctly done, there is no need to keep all the variables as it requires unecessary RAM.
data <- data[,.(EVTYPE, FATALITIES, INJURIES, PROPDMG, PROPDMGEXP, CROPDMG, CROPDMGEXP, time_event, year)]
Based on the documentation provided, a list of possible events is created. This list will be used to compare with EVTYPE and categorize properly storms and other severe weather events.
## This is the list of possible events based on the document provided
list_of_possible_events = unique(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", "Frost", "Freeze", "Funnel Cloud", "Freezing Fog", "Hail", "Heat", "Heavy Rain",
"Heavy Snow", "High Surf", "High Wind", "Hurricane", "Typhoon", "Ice Storm", "Lake-Effect Snow", "Lakeshore Flood", "Lightning",
"Marine Hail", "Marine High Wind", "Marine Strong Wind", "Marine Thunderstorm Wind", "Rip Current", "Seiche", "Sleet", "Storm Surge", "Tide",
"Strong Wind", "Thunderstorm Wind", "Tornado", "Tropical Depression", "Tropical Storm", "Tsunami", "Volcanic Ash", "Waterspout", "Wildfire",
"Winter Storm", "Winter Weather"))
list_of_possible_events
## [1] "Astronomical Low Tide" "Avalanche"
## [3] "Blizzard" "Coastal Flood"
## [5] "Cold" "Wind Chill"
## [7] "Debris Flow" "Dense Fog"
## [9] "Dense Smoke" "Drought"
## [11] "Dust Devil" "Dust Storm"
## [13] "Excessive Heat" "Extreme Cold"
## [15] "Flash Flood" "Flood"
## [17] "Frost" "Freeze"
## [19] "Funnel Cloud" "Freezing Fog"
## [21] "Hail" "Heat"
## [23] "Heavy Rain" "Heavy Snow"
## [25] "High Surf" "High Wind"
## [27] "Hurricane" "Typhoon"
## [29] "Ice Storm" "Lake-Effect Snow"
## [31] "Lakeshore Flood" "Lightning"
## [33] "Marine Hail" "Marine High Wind"
## [35] "Marine Strong Wind" "Marine Thunderstorm Wind"
## [37] "Rip Current" "Seiche"
## [39] "Sleet" "Storm Surge"
## [41] "Tide" "Strong Wind"
## [43] "Thunderstorm Wind" "Tornado"
## [45] "Tropical Depression" "Tropical Storm"
## [47] "Tsunami" "Volcanic Ash"
## [49] "Waterspout" "Wildfire"
## [51] "Winter Storm" "Winter Weather"
## Sorted so that longest name comes first
sorted_list_of_possible_events <- unique(list_of_possible_events[order(vapply(list_of_possible_events, nchar, 1L), decreasing = TRUE)])
sorted_list_of_possible_events
## [1] "Marine Thunderstorm Wind" "Astronomical Low Tide"
## [3] "Tropical Depression" "Marine Strong Wind"
## [5] "Thunderstorm Wind" "Lake-Effect Snow"
## [7] "Marine High Wind" "Lakeshore Flood"
## [9] "Excessive Heat" "Tropical Storm"
## [11] "Winter Weather" "Coastal Flood"
## [13] "Extreme Cold" "Funnel Cloud"
## [15] "Freezing Fog" "Volcanic Ash"
## [17] "Winter Storm" "Debris Flow"
## [19] "Dense Smoke" "Flash Flood"
## [21] "Marine Hail" "Rip Current"
## [23] "Storm Surge" "Strong Wind"
## [25] "Wind Chill" "Dust Devil"
## [27] "Dust Storm" "Heavy Rain"
## [29] "Heavy Snow" "Waterspout"
## [31] "Avalanche" "Dense Fog"
## [33] "High Surf" "High Wind"
## [35] "Hurricane" "Ice Storm"
## [37] "Lightning" "Blizzard"
## [39] "Wildfire" "Drought"
## [41] "Typhoon" "Tornado"
## [43] "Tsunami" "Freeze"
## [45] "Seiche" "Flood"
## [47] "Frost" "Sleet"
## [49] "Cold" "Hail"
## [51] "Heat" "Tide"
As mentioned, EVTYPE contains many more categories than what is included in the list of possible events. For this part of the data processing we work with a copy of the data. The first step is to convert copy_EVTYPE so that it’s levels have a simlar format that the list of possible events. As such we remove extra spaces and capitalize only the first letter of each word. We also eliminate “s” at the end of words.
As some words seems more problematic than others, we grab first 4 letters of each possible events and we look for similar names to find typo errors. We remove from the list valid arguments and at first we only look at cases with more than 25 occurrences to look for major problems – “Thunderstorm” seems to have multiple possible typos. We correct copy_EVTYPE based on those findings.
We then do the same (comparing the first 4 letters of each possible events) for case with less than 15 mismatch small easy fixes. After this tedious process is done, with finish by reassessing all case with more than 15 case of possibles typos.
Finally, we drop some lines that start with “summary” or with “?”.
Using the list of possible events, we create a new events list (going from bigger to smaller categories - based on string length).
Some entries are difficult to re-categories, we we put them in a special category labelled “Hard to categorize”.
## Convert EVTYPE to factor for easier analysis - creating copy first
## Comparing this list to that actual recording clearly show the input of information is not the same
## need to put words in a similar format first
data[,copy_EVTYPE := as.factor(EVTYPE)]
data[,copy_EVTYPE := str_to_title(copy_EVTYPE)][,copy_EVTYPE := gsub(" [Aa][Nn][Dd]|-|/|;"," & ", copy_EVTYPE)]
data[,copy_EVTYPE := gsub("s\\b","", copy_EVTYPE)][,copy_EVTYPE := str_squish(copy_EVTYPE)]
levels_copy_EVTYPE <- levels(droplevels(as.factor(data$copy_EVTYPE)))
original_size <- nrow(data)
## Some words seems more problematics than others
## Grap first 4 letters of each possible events and look for similar names (looking for errors)
## Remove from list valid arguments not to recode them
## Only look at case with more than 25 occurrences to look for major problems first
for (i in sorted_list_of_possible_events) {
p <- unique(levels_copy_EVTYPE[grep(str_squish(substr(i, start = 1, stop = 4)),levels_copy_EVTYPE)])
q <- p[!grepl(paste0(i,"\\b"),p)]
q <- q[q %in% list_of_possible_events == FALSE]
if (length(q) >= 25){
print(noquote(""))
print(paste0("String event look-up: ", str_squish(substr(i, start = 1, stop = 4)), " from ", i))
print("List of potential mistmatch: ")
print(q)
}
}
## [1]
## [1] "String event look-up: Thun from Thunderstorm Wind"
## [1] "List of potential mistmatch: "
## [1] "Flash Flooding & Thunderstorm Wi" "Lightning & Thunderstorm Win"
## [3] "Lightning Thunderstorm Winds" "Severe Thunderstorm"
## [5] "Thundeerstorm Wind" "Thunderestorm Wind"
## [7] "Thundersnow" "Thundersnow Shower"
## [9] "Thunderstorm" "Thunderstorm Damage"
## [11] "Thunderstorm Damage To" "Thunderstorm Hail"
## [13] "Thunderstorm W Ind" "Thunderstorm Win"
## [15] "Thunderstorm Winds" "Thunderstorm Winds53"
## [17] "Thunderstorm Windshail" "Thunderstormw"
## [19] "Thunderstormw 50" "Thunderstormw Wind"
## [21] "Thunderstormwind" "Thunderstrom Wind"
## [23] "Thundertorm Wind" "Thundertsorm Wind"
## [25] "Thundestorm Wind" "Thunerstorm Wind"
## [1]
## [1] "String event look-up: Free from Freezing Fog"
## [1] "List of potential mistmatch: "
## [1] "Agricultural Freeze" "Blizzard & Freezing Rain"
## [3] "Damaging Freeze" "Early Freeze"
## [5] "Freezing Drizzle" "Freezing Drizzle & Freezing"
## [7] "Freezing Rain" "Freezing Rain & Sleet"
## [9] "Freezing Rain & Snow" "Freezing Rain Sleet &"
## [11] "Freezing Rain Sleet & Light" "Freezing Spray"
## [13] "Frost & Freeze" "Frost\\Freeze"
## [15] "Hard Freeze" "Heavy Snow & Freezing Rain"
## [17] "Heavy Snow & High Wind & Freezing" "Heavy Snow Freezing Rain"
## [19] "High Wind & Blizzard & Freezing Ra" "Late Freeze"
## [21] "Light Freezing Rain" "Light Snow & Freezing Precip"
## [23] "Sleet & Freezing Rain" "Snow & Freezing Rain"
## [25] "Snow & Sleet & Freezing Rain" "Snow Freezing Rain"
## [1]
## [1] "String event look-up: Wind from Wind Chill"
## [1] "List of potential mistmatch: "
## [1] "Blizzard & Extreme Wind Chil" "Blizzard & High Wind"
## [3] "Blowing Snow & Extreme Wind Ch" "Blowing Snow & Extreme Wind Chi"
## [5] "Blowing Snow & Extreme Wind Chil" "Cold & Wind"
## [7] "Downburst Wind" "Dry Microburst Wind"
## [9] "Dry Mircoburst Wind" "Dust Storm & High Wind"
## [11] "Extreme Windchill" "Extreme Windchill Temperature"
## [13] "Flash Flood Wind" "Flood & Rain & Wind"
## [15] "Flood & Strong Wind" "Gradient Wind"
## [17] "Gusty Lake Wind" "Gusty Thunderstorm Wind"
## [19] "Gusty Wind" "Gusty Wind & Hail"
## [21] "Gusty Wind & Hvy Rain" "Gusty Wind & Rain"
## [23] "Hail & Wind" "Heavy Rain & Urban Flood Wind &"
## [25] "Heavy Rain & Wind" "Heavy Snow & High Wind"
## [27] "Heavy Snow & High Wind & Flood" "Heavy Snow & High Wind & Freezing"
## [29] "Heavy Snow & Strong Wind" "Heavy Snow & Wind"
## [31] "Heavy Surf & Wind" "High Wind &"
## [33] "High Wind & Blizzard" "High Wind & Blizzard & Freezing Ra"
## [35] "High Wind & Coastal Flood" "High Wind & Cold"
## [37] "High Wind & Flooding" "High Wind & Heavy Rain"
## [39] "High Wind & Heavy Snow" "High Wind & High Tide"
## [41] "High Wind & Sea" "High Wind & Snow"
## [43] "High Wind (G40)" "High Wind 48"
## [45] "High Wind 55" "High Wind 57"
## [47] "High Wind 58" "High Wind 63"
## [49] "High Wind 66" "High Wind 67"
## [51] "High Wind 70" "High Wind 73"
## [53] "High Wind 76" "High Wind 80"
## [55] "High Wind 82" "High Wind Damage"
## [57] "High Wind Dust Storm" "High Wind Heavy Rain"
## [59] "Hurricane Opal & High Wind" "Ice & Strong Wind"
## [61] "Lightning & Wind" "Lightning Thunderstorm Wind"
## [63] "Lightning Thunderstorm Winds" "Marine Tstm Wind"
## [65] "Microburst Wind" "Non & Severe Wind Damage"
## [67] "Non & Tstm Wind" "Non Tstm Wind"
## [69] "Rain & Wind" "Record Cold & High Wind"
## [71] "Severe Thunderstorm Wind" "Snow & High Wind"
## [73] "Snow & Wind" "Storm Force Wind"
## [75] "Strong Wind Gust" "Thuderstorm Wind"
## [77] "Thundeerstorm Wind" "Thunderestorm Wind"
## [79] "Thunderstorm Wind &" "Thunderstorm Wind & Awning"
## [81] "Thunderstorm Wind & Flash Flood" "Thunderstorm Wind & Flood"
## [83] "Thunderstorm Wind & Flooding" "Thunderstorm Wind & Funnel Clou"
## [85] "Thunderstorm Wind & Hail" "Thunderstorm Wind & Heavy Rain"
## [87] "Thunderstorm Wind & Lightning" "Thunderstorm Wind & Tree"
## [89] "Thunderstorm Wind (G40)" "Thunderstorm Wind 13"
## [91] "Thunderstorm Wind 2" "Thunderstorm Wind 50"
## [93] "Thunderstorm Wind 52" "Thunderstorm Wind 53"
## [95] "Thunderstorm Wind 56" "Thunderstorm Wind 59"
## [97] "Thunderstorm Wind 59 Mph" "Thunderstorm Wind 59 Mph."
## [99] "Thunderstorm Wind 60" "Thunderstorm Wind 60 Mph"
## [101] "Thunderstorm Wind 61" "Thunderstorm Wind 62"
## [103] "Thunderstorm Wind 63 Mph" "Thunderstorm Wind 65 Mph"
## [105] "Thunderstorm Wind 65mph" "Thunderstorm Wind 69"
## [107] "Thunderstorm Wind 98 Mph" "Thunderstorm Wind Funnel Clou"
## [109] "Thunderstorm Wind G" "Thunderstorm Wind G50"
## [111] "Thunderstorm Wind G51" "Thunderstorm Wind G52"
## [113] "Thunderstorm Wind G55" "Thunderstorm Wind G60"
## [115] "Thunderstorm Wind G61" "Thunderstorm Wind Hail"
## [117] "Thunderstorm Wind Heavy Rain" "Thunderstorm Wind Le Cen"
## [119] "Thunderstorm Wind Lightning" "Thunderstorm Wind Small Strea"
## [121] "Thunderstorm Wind Tree" "Thunderstorm Wind Urban Flood"
## [123] "Thunderstorm Wind." "Thunderstorm Winds"
## [125] "Thunderstorm Winds53" "Thunderstorm Windshail"
## [127] "Thunderstormw Wind" "Thunderstrom Wind"
## [129] "Thundertorm Wind" "Thundertsorm Wind"
## [131] "Thundestorm Wind" "Thunerstorm Wind"
## [133] "Tornadoe, Tstm Wind, Hail" "Tstm Wind"
## [135] "Tstm Wind & Hail" "Tstm Wind & Lightning"
## [137] "Tstm Wind (41)" "Tstm Wind (G35)"
## [139] "Tstm Wind (G40)" "Tstm Wind (G45)"
## [141] "Tstm Wind 40" "Tstm Wind 45"
## [143] "Tstm Wind 50" "Tstm Wind 51"
## [145] "Tstm Wind 52" "Tstm Wind 55"
## [147] "Tstm Wind 65)" "Tstm Wind Damage"
## [149] "Tstm Wind G45" "Tstm Wind G58"
## [151] "Tunderstorm Wind" "Wake Low Wind"
## [153] "Wind" "Wind & Hail"
## [155] "Wind & Wave" "Wind Advisory"
## [157] "Wind Damage" "Wind Gust"
## [159] "Wind Storm" "Winter Storm & High Wind"
## [161] "Winter Storm High Wind"
## [1]
## [1] "String event look-up: Heav from Heavy Rain"
## [1] "List of potential mistmatch: "
## [1] "Blizzard & Heavy Snow" "Heavy Lake Snow"
## [3] "Heavy Mix" "Heavy Precipatation"
## [5] "Heavy Precipitation" "Heavy Rainfall"
## [7] "Heavy Sea" "Heavy Shower"
## [9] "Heavy Snow &" "Heavy Snow & Blizzard"
## [11] "Heavy Snow & Blizzard & Avalanche" "Heavy Snow & blowing Snow"
## [13] "Heavy Snow & Blowing Snow" "Heavy Snow & Freezing Rain"
## [15] "Heavy Snow & High" "Heavy Snow & High Wind"
## [17] "Heavy Snow & High Wind & Flood" "Heavy Snow & High Wind & Freezing"
## [19] "Heavy Snow & Ice" "Heavy Snow & Ice Storm"
## [21] "Heavy Snow & Sleet" "Heavy Snow & Squall"
## [23] "Heavy Snow & Strong Wind" "Heavy Snow & Wind"
## [25] "Heavy Snow & Winter Storm" "Heavy Snow Freezing Rain"
## [27] "Heavy Snow Shower" "Heavy Snow Squall"
## [29] "Heavy Snowpack" "Heavy Surf"
## [31] "Heavy Surf & High Surf" "Heavy Surf & Wind"
## [33] "Heavy Surf Coastal Flooding" "Heavy Swell"
## [35] "Heavy Wet Snow" "High Wind & Heavy Snow"
## [37] "Rain (Heavy)" "Rip Current & Heavy Surf"
## [39] "Rip Current Heavy Surf" "Snow & Heavy Snow"
## [1]
## [1] "String event look-up: Heav from Heavy Snow"
## [1] "List of potential mistmatch: "
## [1] "Flash Flood & Heavy Rain" "Flood & Heavy Rain"
## [3] "Flooding & Heavy Rain" "Heavy Lake Snow"
## [5] "Heavy Mix" "Heavy Precipatation"
## [7] "Heavy Precipitation" "Heavy Rain & Flood"
## [9] "Heavy Rain & Flooding" "Heavy Rain & High Surf"
## [11] "Heavy Rain & Lightning" "Heavy Rain & Mudslide & Flood"
## [13] "Heavy Rain & Severe Weather" "Heavy Rain & Small Stream Urban"
## [15] "Heavy Rain & Snow" "Heavy Rain & Urban Flood"
## [17] "Heavy Rain & Urban Flood Wind &" "Heavy Rain & Wind"
## [19] "Heavy Rain Effect" "Heavy Rainfall"
## [21] "Heavy Sea" "Heavy Shower"
## [23] "Heavy Snowpack" "Heavy Surf"
## [25] "Heavy Surf & High Surf" "Heavy Surf & Wind"
## [27] "Heavy Surf Coastal Flooding" "Heavy Swell"
## [29] "Heavy Wet Snow" "High Wind & Heavy Rain"
## [31] "High Wind Heavy Rain" "Lightning & Heavy Rain"
## [33] "Locally Heavy Rain" "Rain (Heavy)"
## [35] "Rip Current & Heavy Surf" "Rip Current Heavy Surf"
## [37] "Thunderstorm Wind & Heavy Rain" "Thunderstorm Wind Heavy Rain"
## [39] "Tstm Heavy Rain"
## [1]
## [1] "String event look-up: High from High Surf"
## [1] "List of potential mistmatch: "
## [1] "Astronomical High Tide" "Blizzard & High Wind"
## [3] "Dust Storm & High Wind" "Heavy Snow & High"
## [5] "Heavy Snow & High Wind" "Heavy Snow & High Wind & Flood"
## [7] "Heavy Snow & High Wind & Freezing" "High"
## [9] "High Sea" "High Swell"
## [11] "High Temperature Record" "High Tide"
## [13] "High Water" "High Wave"
## [15] "High Wind &" "High Wind & Blizzard"
## [17] "High Wind & Blizzard & Freezing Ra" "High Wind & Coastal Flood"
## [19] "High Wind & Cold" "High Wind & Flooding"
## [21] "High Wind & Heavy Rain" "High Wind & Heavy Snow"
## [23] "High Wind & High Tide" "High Wind & Low Wind Chill"
## [25] "High Wind & Sea" "High Wind & Snow"
## [27] "High Wind & Wind Chill" "High Wind & Wind Chill & Blizzard"
## [29] "High Wind (G40)" "High Wind 48"
## [31] "High Wind 55" "High Wind 57"
## [33] "High Wind 58" "High Wind 63"
## [35] "High Wind 66" "High Wind 67"
## [37] "High Wind 70" "High Wind 73"
## [39] "High Wind 76" "High Wind 80"
## [41] "High Wind 82" "High Wind Damage"
## [43] "High Wind Dust Storm" "High Wind Heavy Rain"
## [45] "Highway Flooding" "Hurricane Opal & High Wind"
## [47] "Record Cold & High Wind" "Record High"
## [49] "Record High Temperature" "Snow & High Wind"
## [51] "Snow & High Wind & Wind Chill" "Wind Chill & High Wind"
## [53] "Winter Storm & High Wind" "Winter Storm High Wind"
## [1]
## [1] "String event look-up: Floo from Flood"
## [1] "List of potential mistmatch: "
## [1] "Breakup Flooding" "Coastal Flooding"
## [3] "Coastal Flooding & Erosion" "Cstl Flooding & Erosion"
## [5] "Flash Flooding" "Flash Flooding & Thunderstorm Wi"
## [7] "Flash Floooding" "Flooding"
## [9] "Flooding & Heavy Rain" "Hail Flooding"
## [11] "Heavy Rain & Flooding" "Heavy Surf Coastal Flooding"
## [13] "High Wind & Flooding" "Highway Flooding"
## [15] "Ice Jam Flooding" "Minor Flooding"
## [17] "Mud Slide Urban Flooding" "River Flooding"
## [19] "Small Stream & Urban Floodin" "Small Stream Flooding"
## [21] "Snowmelt Flooding" "Stream Flooding"
## [23] "Street Flooding" "Thunderstorm Wind & Flooding"
## [25] "Tidal Flooding" "Urban & Small Flooding"
## [27] "Urban & Small Stream Floodin" "Urban & Small Stream Flooding"
## [29] "Urban & Street Flooding" "Urban Flooding"
# [1] "String event look-up: Thun from Thunderstorm Wind"
# [1] "List of potential mistmatch: "
# [1] "Flash Flooding & Thunderstorm Wi" "Lightning & Thunderstorm Win" "Lightning Thunderstorm Winds" "Severe Thunderstorm"
# [5] "Thundeerstorm Wind" "Thunderestorm Wind" "Thundersnow" "Thundersnow Shower"
# [9] "Thunderstorm" "Thunderstorm Damage" "Thunderstorm Damage To" "Thunderstorm Hail"
# [13] "Thunderstorm W Ind" "Thunderstorm Win" "Thunderstorm Winds" "Thunderstorm Winds53"
# [17] "Thunderstorm Windshail" "Thunderstormw" "Thunderstormw 50" "Thunderstormw Wind"
# [21] "Thunderstormwind" "Thunderstrom Wind" "Thundertorm Wind" "Thundertsorm Wind"
# [25] "Thundestorm Wind" "Thunerstorm Wind"
recode_list <- paste0("\\b",unique(c(
"Thundeerstorm", "Thunderestorm", "Thundersnow", "Thunderstormw", "Thunderstormwind", "Thunderstrom", "Thundertorm", "Thundertsorm", "Thundestorm", "Thunerstorm"
)),"\\b")
recode_to <- unique(c("Thunderstorm"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
recode_list <- paste0("\\b",unique(c(
"Thunderstorm W Ind", "Thunderstorm Win", "Thunderstorm Winds", "Thunderstorm Winds53", "Thunderstormwind", "Thunderstorm Wi", "Severe Thunderstorm",
"Thunderstorm 50", "Thunderstorm Damage", "Thunderstorm Damage To"
)),"\\b")
recode_to <- unique(c("Thunderstorm Wind"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
recode_list <- paste0("\\b",unique(c(
"Thunderstorm Hail", "Thunderstorm Windshail"
)),"\\b")
recode_to <- unique(c("Thunderstorm Wind & Hail"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
# [1] "String event look-up: Wind from Wind Chill"
# [1] "List of potential mistmatch: "
# [1] "Blizzard & Extreme Wind Chil" "Blizzard & High Wind" "Blowing Snow & Extreme Wind Ch" "Blowing Snow & Extreme Wind Chi"
# [5] "Blowing Snow & Extreme Wind Chil" "Cold & Wind" "Downburst Wind" "Dry Microburst Wind"
# [9] "Dry Mircoburst Wind" "Dust Storm & High Wind" "Extreme Windchill" "Extreme Windchill Temperature"
# [13] "Flash Flood Wind" "Flood & Rain & Wind" "Flood & Strong Wind" "Gradient Wind"
# [17] "Gusty Lake Wind" "Gusty Thunderstorm Wind" "Gusty Wind" "Gusty Wind & Hail"
# [21] "Gusty Wind & Hvy Rain" "Gusty Wind & Rain" "Hail & Wind" "Heavy Rain & Urban Flood Wind &"
# [25] "Heavy Rain & Wind" "Heavy Snow & High Wind" "Heavy Snow & High Wind & Flood" "Heavy Snow & High Wind & Freezing"
# [29] "Heavy Snow & Strong Wind" "Heavy Snow & Wind" "Heavy Surf & Wind" "High Wind &"
# [33] "High Wind & Blizzard" "High Wind & Blizzard & Freezing Ra" "High Wind & Coastal Flood" "High Wind & Cold"
# [37] "High Wind & Flooding" "High Wind & Heavy Rain" "High Wind & Heavy Snow" "High Wind & High Tide"
# [41] "High Wind & Sea" "High Wind & Snow" "High Wind (G40)" "High Wind 48"
# [45] "High Wind 55" "High Wind 57" "High Wind 58" "High Wind 63"
# [49] "High Wind 66" "High Wind 67" "High Wind 70" "High Wind 73"
# [53] "High Wind 76" "High Wind 80" "High Wind 82" "High Wind Damage"
# [57] "High Wind Dust Storm" "High Wind Heavy Rain" "Hurricane Opal & High Wind" "Ice & Strong Wind"
# [61] "Lightning & Wind" "Lightning Thunderstorm Wind" "Lightning Thunderstorm Winds" "Marine Tstm Wind"
# [65] "Microburst Wind" "Non & Severe Wind Damage" "Non & Tstm Wind" "Non Tstm Wind"
# [69] "Rain & Wind" "Record Cold & High Wind" "Severe Thunderstorm Wind" "Snow & High Wind"
# [73] "Snow & Wind" "Storm Force Wind" "Strong Wind Gust" "Thuderstorm Wind"
# [77] "Thundeerstorm Wind" "Thunderestorm Wind" "Thunderstorm Wind &" "Thunderstorm Wind & Awning"
# [81] "Thunderstorm Wind & Flash Flood" "Thunderstorm Wind & Flood" "Thunderstorm Wind & Flooding" "Thunderstorm Wind & Funnel Clou"
# [85] "Thunderstorm Wind & Hail" "Thunderstorm Wind & Heavy Rain" "Thunderstorm Wind & Lightning" "Thunderstorm Wind & Tree"
# [89] "Thunderstorm Wind (G40)" "Thunderstorm Wind 13" "Thunderstorm Wind 2" "Thunderstorm Wind 50"
# [93] "Thunderstorm Wind 52" "Thunderstorm Wind 53" "Thunderstorm Wind 56" "Thunderstorm Wind 59"
# [97] "Thunderstorm Wind 59 Mph" "Thunderstorm Wind 59 Mph." "Thunderstorm Wind 60" "Thunderstorm Wind 60 Mph"
# [101] "Thunderstorm Wind 61" "Thunderstorm Wind 62" "Thunderstorm Wind 63 Mph" "Thunderstorm Wind 65 Mph"
# [105] "Thunderstorm Wind 65mph" "Thunderstorm Wind 69" "Thunderstorm Wind 98 Mph" "Thunderstorm Wind Funnel Clou"
# [109] "Thunderstorm Wind G" "Thunderstorm Wind G50" "Thunderstorm Wind G51" "Thunderstorm Wind G52"
# [113] "Thunderstorm Wind G55" "Thunderstorm Wind G60" "Thunderstorm Wind G61" "Thunderstorm Wind Hail"
# [117] "Thunderstorm Wind Heavy Rain" "Thunderstorm Wind Le Cen" "Thunderstorm Wind Lightning" "Thunderstorm Wind Small Strea"
# [121] "Thunderstorm Wind Tree" "Thunderstorm Wind Urban Flood" "Thunderstorm Wind." "Thunderstorm Winds"
# [125] "Thunderstorm Winds53" "Thunderstorm Windshail" "Thunderstormw Wind" "Thunderstrom Wind"
# [129] "Thundertorm Wind" "Thundertsorm Wind" "Thundestorm Wind" "Thunerstorm Wind"
# [133] "Tornadoe, Tstm Wind, Hail" "Tstm Wind" "Tstm Wind & Hail" "Tstm Wind & Lightning"
# [137] "Tstm Wind (41)" "Tstm Wind (G35)" "Tstm Wind (G40)" "Tstm Wind (G45)"
# [141] "Tstm Wind 40" "Tstm Wind 45" "Tstm Wind 50" "Tstm Wind 51"
# [145] "Tstm Wind 52" "Tstm Wind 55" "Tstm Wind 65)" "Tstm Wind Damage"
# [149] "Tstm Wind G45" "Tstm Wind G58" "Tunderstorm Wind" "Wake Low Wind"
# [153] "Wind" "Wind & Hail" "Wind & Wave" "Wind Advisory"
# [157] "Wind Damage" "Wind Gust" "Wind Storm" "Winter Storm & High Wind"
# [161] "Winter Storm High Wind"
recode_list <- paste0("\\b",unique(c(
"Tstm"
)),"\\b")
recode_to <- unique(c("Thunderstorm"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
# [1] "String event look-up: Heav from Heavy Rain"
# [1] "List of potential mistmatch: "
# [1] "Blizzard & Heavy Snow" "Heavy Lake Snow" "Heavy Mix" "Heavy Precipatation"
# [5] "Heavy Precipitation" "Heavy Rainfall" "Heavy Sea" "Heavy Shower"
# [9] "Heavy Snow &" "Heavy Snow & Blizzard" "Heavy Snow & Blizzard & Avalanche" "Heavy Snow & blowing Snow"
# [13] "Heavy Snow & Blowing Snow" "Heavy Snow & Freezing Rain" "Heavy Snow & High" "Heavy Snow & High Wind"
# [17] "Heavy Snow & High Wind & Flood" "Heavy Snow & High Wind & Freezing" "Heavy Snow & Ice" "Heavy Snow & Ice Storm"
# [21] "Heavy Snow & Sleet" "Heavy Snow & Squall" "Heavy Snow & Strong Wind" "Heavy Snow & Wind"
# [25] "Heavy Snow & Winter Storm" "Heavy Snow Freezing Rain" "Heavy Snow Shower" "Heavy Snow Squall"
# [29] "Heavy Snowpack" "Heavy Surf" "Heavy Surf & High Surf" "Heavy Surf & Wind"
# [33] "Heavy Surf Coastal Flooding" "Heavy Swell" "Heavy Wet Snow" "High Wind & Heavy Snow"
# [37] "Rain (Heavy)" "Rip Current & Heavy Surf" "Rip Current Heavy Surf" "Snow & Heavy Snow"
recode_list <- paste0("\\b",unique(c(
"Heavy Rainfall", "Heavy Shower", "Rain (Heavy)"
)),"\\b")
recode_to <- unique(c("Heavy Rain"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
# [1] "String event look-up: Heav from Heavy Snow"
# [1] "List of potential mistmatch: "
# [1] "Flash Flood & Heavy Rain" "Flood & Heavy Rain" "Flooding & Heavy Rain" "Heavy Lake Snow"
# [5] "Heavy Mix" "Heavy Precipatation" "Heavy Precipitation" "Heavy Rain & Flood"
# [9] "Heavy Rain & Flooding" "Heavy Rain & High Surf" "Heavy Rain & Lightning" "Heavy Rain & Mudslide & Flood"
# [13] "Heavy Rain & Severe Weather" "Heavy Rain & Small Stream Urban" "Heavy Rain & Snow" "Heavy Rain & Urban Flood"
# [17] "Heavy Rain & Urban Flood Wind &" "Heavy Rain & Wind" "Heavy Rain Effect" "Heavy Rainfall"
# [21] "Heavy Sea" "Heavy Shower" "Heavy Snowpack" "Heavy Surf"
# [25] "Heavy Surf & High Surf" "Heavy Surf & Wind" "Heavy Surf Coastal Flooding" "Heavy Swell"
# [29] "Heavy Wet Snow" "High Wind & Heavy Rain" "High Wind Heavy Rain" "Lightning & Heavy Rain"
# [33] "Locally Heavy Rain" "Rain (Heavy)" "Rip Current & Heavy Surf" "Rip Current Heavy Surf"
# [37] "Thunderstorm Wind & Heavy Rain" "Thunderstorm Wind Heavy Rain" "Tstm Heavy Rain"
recode_list <- paste0("\\b",unique(c(
"Heavy Snowpack", "Heavy Wet Snow"
)),"\\b")
recode_to <- unique(c("Heavy Snow"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
## Grap first 4 letters of each possible events and look for similar names (looking for errors)
## Remove from list valid arguments not to recode them
## Only look at case with more less than 15 occurrences to look for small easy fix
levels_copy_EVTYPE <- levels(as.factor(data$copy_EVTYPE))
for (i in sorted_list_of_possible_events) {
p <- unique(levels_copy_EVTYPE[grep(str_squish(substr(i, start = 1, stop = 4)),levels_copy_EVTYPE)])
q <- p[!grepl(paste0(i,"\\b"),p)]
q <- q[q %in% list_of_possible_events == FALSE]
if (length(q) != 0 & length(q) <= 15){
print(noquote(""))
print(paste0("String event look-up: ", str_squish(substr(i, start = 1, stop = 4)), " from ", i))
print("List of potential mistmatch: ")
print(q)
}
}
## [1]
## [1] "String event look-up: Mari from Marine Thunderstorm Wind"
## [1] "List of potential mistmatch: "
## [1] "Marine Accident" "Marine Mishap"
## [1]
## [1] "String event look-up: Astr from Astronomical Low Tide"
## [1] "List of potential mistmatch: "
## [1] "Astronomical High Tide"
## [1]
## [1] "String event look-up: Trop from Tropical Depression"
## [1] "List of potential mistmatch: "
## [1] "Tropical Storm Alberto" "Tropical Storm Dean" "Tropical Storm Gordon"
## [4] "Tropical Storm Jerry"
## [1]
## [1] "String event look-up: Mari from Marine Strong Wind"
## [1] "List of potential mistmatch: "
## [1] "Marine Accident" "Marine Mishap"
## [1]
## [1] "String event look-up: Thun from Thunderstorm Wind"
## [1] "List of potential mistmatch: "
## [1] "Thunderstorm" "Thunderstorm Heavy Rain"
## [3] "Thunderstorm Shower" "Thunderstorm Wnd"
## [1]
## [1] "String event look-up: Lake from Lake-Effect Snow"
## [1] "List of potential mistmatch: "
## [1] "Gusty Lake Wind" "Heavy Lake Snow" "Lake & Effect Snow"
## [4] "Lake Effect Snow" "Lake Flood"
## [1]
## [1] "String event look-up: Mari from Marine High Wind"
## [1] "List of potential mistmatch: "
## [1] "Marine Accident" "Marine Mishap"
## [1]
## [1] "String event look-up: Lake from Lakeshore Flood"
## [1] "List of potential mistmatch: "
## [1] "Gusty Lake Wind" "Heavy Lake Snow" "Lake & Effect Snow"
## [4] "Lake Effect Snow" "Lake Flood"
## [1]
## [1] "String event look-up: Exce from Excessive Heat"
## [1] "List of potential mistmatch: "
## [1] "Excessive" "Excessive Cold"
## [3] "Excessive Precipitation" "Excessive Rain"
## [5] "Excessive Rainfall" "Excessive Snow"
## [7] "Excessive Wetnes" "Excessively Dry"
## [9] "Record & Excessive Rainfall"
## [1]
## [1] "String event look-up: Wint from Winter Weather"
## [1] "List of potential mistmatch: "
## [1] "Blizzard & Winter Storm" "Heavy Snow & Winter Storm"
## [3] "Record Winter Snow" "Winter Mix"
## [5] "Winter Storm & High Wind" "Winter Storm High Wind"
## [7] "Wintery Mix" "Wintry Mix"
## [1]
## [1] "String event look-up: Coas from Coastal Flood"
## [1] "List of potential mistmatch: "
## [1] "Coastal & Tidal Flood" "Coastal Erosion"
## [3] "Coastal Flooding" "Coastal Flooding & Erosion"
## [5] "Coastal Storm" "Coastal Surge"
## [7] "Coastalflood" "Coastalstorm"
## [9] "Heavy Surf Coastal Flooding"
## [1]
## [1] "String event look-up: Extr from Extreme Cold"
## [1] "List of potential mistmatch: "
## [1] "Blizzard & Extreme Wind Chil" "Blowing Snow & Extreme Wind Ch"
## [3] "Blowing Snow & Extreme Wind Chi" "Blowing Snow & Extreme Wind Chil"
## [5] "Extreme & Record Cold" "Extreme Heat"
## [7] "Extreme Wind Chill" "Extreme Wind Chill & Blowing Sno"
## [9] "Extreme Windchill" "Extreme Windchill Temperature"
## [11] "Extremely Wet"
## [1]
## [1] "String event look-up: Funn from Funnel Cloud"
## [1] "List of potential mistmatch: "
## [1] "Cold Air Funnel" "Funnel"
## [3] "Thunderstorm Wind & Funnel Clou" "Thunderstorm Wind Funnel Clou"
## [1]
## [1] "String event look-up: Volc from Volcanic Ash"
## [1] "List of potential mistmatch: "
## [1] "Volcanic Ashfall" "Volcanic Eruption"
## [1]
## [1] "String event look-up: Wint from Winter Storm"
## [1] "List of potential mistmatch: "
## [1] "Record Winter Snow" "Winter Mix" "Winter Weather & Mix"
## [4] "Winter Weather Mix" "Wintery Mix" "Wintry Mix"
## [1]
## [1] "String event look-up: Debr from Debris Flow"
## [1] "List of potential mistmatch: "
## [1] "Tornado Debri"
## [1]
## [1] "String event look-up: Dens from Dense Smoke"
## [1] "List of potential mistmatch: "
## [1] "Patchy Dense Fog"
## [1]
## [1] "String event look-up: Flas from Flash Flood"
## [1] "List of potential mistmatch: "
## [1] "Flash Flooding" "Flash Flooding & Flood"
## [3] "Flash Flooding & Thunderstorm Wind" "Flash Floooding"
## [5] "Flood & Flash" "Flood & Flash & Flood"
## [7] "Flood & Flash Flooding" "Flood & Flashflood"
## [9] "Flood Flash" "Flood Flood & Flash"
## [1]
## [1] "String event look-up: Mari from Marine Hail"
## [1] "List of potential mistmatch: "
## [1] "Marine Accident" "Marine Mishap"
## [1]
## [1] "String event look-up: Dust from Dust Devil"
## [1] "List of potential mistmatch: "
## [1] "Blowing Dust" "Dust Devel" "Dust Storm & High Wind"
## [4] "Duststorm" "High Wind Dust Storm" "Saharan Dust"
## [1]
## [1] "String event look-up: Dust from Dust Storm"
## [1] "List of potential mistmatch: "
## [1] "Blowing Dust" "Dust Devel" "Dust Devil Waterspout"
## [4] "Duststorm" "Saharan Dust"
## [1]
## [1] "String event look-up: Wate from Waterspout"
## [1] "List of potential mistmatch: "
## [1] "High Water" "Rapidly Rising Water" "Water Spout"
## [1]
## [1] "String event look-up: Aval from Avalanche"
## [1] "List of potential mistmatch: "
## [1] "Avalance"
## [1]
## [1] "String event look-up: Ligh from Lightning"
## [1] "List of potential mistmatch: "
## [1] "Freezing Rain Sleet & Light" "Light Freezing Rain"
## [3] "Light Snow" "Light Snow & Flurrie"
## [5] "Light Snow & Freezing Precip" "Light Snow & Sleet"
## [7] "Light Snowfall" "Lighting"
## [9] "Northern Light"
## [1]
## [1] "String event look-up: Wild from Wildfire"
## [1] "List of potential mistmatch: "
## [1] "Wild & Forest Fire" "Wild Fire"
## [1]
## [1] "String event look-up: Torn from Tornado"
## [1] "List of potential mistmatch: "
## [1] "Tornadoe" "Tornadoe, Thunderstorm Wind, Hail"
## [3] "Torndao"
## [1]
## [1] "String event look-up: Hail from Hail"
## [1] "List of potential mistmatch: "
## [1] "Hailstorm"
## [1]
## [1] "String event look-up: Heat from Heat"
## [1] "List of potential mistmatch: "
## [1] "Heatburst"
# [1] "String event look-up: Thun from Thunderstorm Wind"
# [1] "List of potential mistmatch: "
# [1] "Thunderstorm" "Thunderstorm Heavy Rain" "Thunderstorm Shower" "Thunderstorm Wnd"
recode_list <- paste0("\\b",unique(c(
"Thunderstorm Wnd", "Thunderstorm Wind", "Thuderstorm Wind", "Tstmw", "Tunderstorm Wind"
)),"\\b")
recode_to <- unique(c("Thunderstorm"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
recode_list <- paste0("\\b",unique(c(
"Thunderstorm"
)),"\\b")
recode_to <- unique(c("Thunderstorm Wind"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
# [1] "String event look-up: Lake from Lake-Effect Snow"
# [1] "List of potential mistmatch: "
# [1] "Gusty Lake Wind" "Heavy Lake Snow" "Lake & Effect Snow" "Lake Effect Snow" "Lake Flood"
recode_list <- paste0("\\b",unique(c(
"Heavy Lake Snow", "Lake & Effect Snow", "Lake Effect Snow"
)),"\\b")
recode_to <- unique(c("Lake-Effect Snow"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
# [1] "String event look-up: Lake from Lakeshore Flood"
# [1] "List of potential mistmatch: "
# [1] "Gusty Lake Wind" "Heavy Lake Snow" "Lake & Effect Snow" "Lake Effect Snow" "Lake Flood"
recode_list <- paste0("\\b",unique(c(
"Lake Flood"
)),"\\b")
recode_to <- unique(c("Lakeshore Flood"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
# [1] "String event look-up: Coas from Coastal Flood"
# [1] "List of potential mistmatch: "
# [1] "Coastal & Tidal Flood" "Coastal Erosion" "Coastal Flooding" "Coastal Flooding & Erosion" "Coastal Storm"
# [6] "Coastal Surge" "Coastalflood" "Coastalstorm" "Heavy Surf Coastal Flooding"
recode_list <- paste0("\\b",unique(c(
"Cstl"
)),"\\b")
recode_to <- unique(c("Coastal"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
recode_list <- paste0("\\b",unique(c(
"Coastal Flooding", "Coastalflood", "Coastal & Tidal Flood"
)),"\\b")
recode_to <- unique(c("Coastal Flood"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
# [1] "String event look-up: Extr from Extreme Cold"
# [1] "List of potential mistmatch: "
# [1] "Blizzard & Extreme Wind Chil" "Blowing Snow & Extreme Wind Ch" "Blowing Snow & Extreme Wind Chi" "Blowing Snow & Extreme Wind Chil"
# [5] "Extreme & Record Cold" "Extreme Heat" "Extreme Wind Chill" "Extreme Wind Chill & Blowing Sno"
# [9] "Extreme Windchill" "Extreme Windchill Temperature" "Extremely Wet"
recode_list <- paste0("\\b",unique(c(
"Extreme Wind Chil", "Extreme Wind Ch", "Extreme Wind Chi", "Extreme Wind Chil", "Extreme & Record Cold", "Extreme Wind Chill", "Extreme Windchill", "Extreme Windchill Temperature"
)),"\\b")
recode_to <- unique(c("Extreme Cold"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
# [1] "String event look-up: Funn from Funnel Cloud"
# [1] "List of potential mistmatch: "
# [1] "Cold Air Funnel" "Funnel" "Thunderstorm Wind & Funnel Clou" "Thunderstorm Wind Funnel Clou"
recode_list <- paste0("\\b",unique(c(
"Funnel Clou"
)),"\\b")
recode_to <- unique(c("Funnel"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
recode_list <- paste0("\\b",unique(c(
"Funnel"
)),"\\b")
recode_to <- unique(c("Funnel Cloud"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
# [1] "String event look-up: Volc from Volcanic Ash"
# [1] "List of potential mistmatch: "
# [1] "Volcanic Ashfall" "Volcanic Eruption"
recode_list <- paste0("\\b",unique(c(
"Volcanic Ashfall", "Volcanic Eruption"
)),"\\b")
recode_to <- unique(c("Volcanic Ash"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
# [1] "String event look-up: Debr from Debris Flow"
# [1] "List of potential mistmatch: "
# [1] "Tornado Debri"
recode_list <- paste0("\\b",unique(c(
"Debri"
)),"\\b")
recode_to <- unique(c("Debris Flow"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
# [1] "String event look-up: Flas from Flash Flood"
# [1] "List of potential mistmatch: "
# [1] "Flash Flooding" "Flash Flooding & Flood" "Flash Flooding & Thunderstorm Wi" "Flash Floooding"
# [5] "Flood & Flash" "Flood & Flash & Flood" "Flood & Flash Flooding" "Flood & Flashflood"
# [9] "Flood Flash" "Flood Flood & Flash"
recode_list <- paste0("\\b",unique(c(
"Flash Flooding", "Flood & Flash", "Flashflood", "Flash Floooding", "Flood Flash"
)),"\\b")
recode_to <- unique(c("Flash Flood"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
# [1] "String event look-up: Dust from Dust Devil"
# [1] "List of potential mistmatch: "
# [1] "Blowing Dust" "Dust Devel" "Dust Storm & High Wind" "Duststorm" "High Wind Dust Storm" "Saharan Dust"
recode_list <- paste0("\\b",unique(c(
"Dust Devel"
)),"\\b")
recode_to <- unique(c("Dust Devil"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
# [1] "String event look-up: Dust from Dust Storm"
# [1] "List of potential mistmatch: "
# [1] "Blowing Dust" "Dust Devel" "Dust Devil Waterspout" "Duststorm" "Saharan Dust"
recode_list <- paste0("\\b",unique(c(
"Blowing Dust", "Duststorm", "Saharan Dust"
)),"\\b")
recode_to <- unique(c("Dust Storm"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
# [1] "String event look-up: Wate from Waterspout"
# [1] "List of potential mistmatch: "
# [1] "High Water" "Rapidly Rising Water" "Water Spout"
recode_list <- paste0("\\b",unique(c(
"Water Spout"
)),"\\b")
recode_to <- unique(c("Waterspout"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
# [1] "String event look-up: Aval from Avalanche"
# [1] "List of potential mistmatch: "
# [1] "Avalance"
recode_list <- paste0("\\b",unique(c(
"Avalance"
)),"\\b")
recode_to <- unique(c("Avalanche"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
# [1] "String event look-up: Ligh from Lightning"
# [1] "List of potential mistmatch: "
# [1] "Freezing Rain Sleet & Light" "Light Freezing Rain" "Light Snow" "Light Snow & Flurrie" "Light Snow & Freezing Precip"
# [6] "Light Snow & Sleet" "Light Snowfall" "Lighting" "Northern Light"
recode_list <- paste0("\\b",unique(c(
"Lighting"
)),"\\b")
recode_to <- unique(c("Lightning"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
# [1] "String event look-up: Wild from Wildfire"
# [1] "List of potential mistmatch: "
# [1] "Wild & Forest Fire" "Wild Fire"
recode_list <- paste0("\\b",unique(c(
"Wild & Forest Fire", "Wild Fire"
)),"\\b")
recode_to <- unique(c("Wildfire"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
# [1] "String event look-up: Torn from Tornado"
# [1] "List of potential mistmatch: "
# [1] "Tornadoe" "Tornadoe, Thunderstorm Wind, Hail" "Torndao"
recode_list <- paste0("\\b",unique(c(
"Tornadoe", "Torndao"
)),"\\b")
recode_to <- unique(c("Tornado"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
# [1] "String event look-up: Hail from Hail"
# [1] "List of potential mistmatch: "
# [1] "Hailstorm"
recode_list <- paste0("\\b",unique(c(
"Hailstorm"
)),"\\b")
recode_to <- unique(c("Hail"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
# [1] "String event look-up: Heat from Heat"
# [1] "List of potential mistmatch: "
# [1] "Heatburst"
recode_list <- paste0("\\b",unique(c(
"Heatburst"
)),"\\b")
recode_to <- unique(c("Heat"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
levels_copy_EVTYPE <- levels(as.factor(data$copy_EVTYPE))
for (i in sorted_list_of_possible_events) {
p <- unique(levels_copy_EVTYPE[grep(str_squish(substr(i, start = 1, stop = 4)),levels_copy_EVTYPE)])
q <- p[!grepl(paste0(i,"\\b"),p)]
q <- q[q %in% list_of_possible_events == FALSE]
if (length(q) > 15){
print(noquote(""))
print(paste0("String event look-up: ", str_squish(substr(i, start = 1, stop = 4)), " from ", i))
print("List of potential mistmatch: ")
print(q)
}
}
## [1]
## [1] "String event look-up: Free from Freezing Fog"
## [1] "List of potential mistmatch: "
## [1] "Agricultural Freeze" "Blizzard & Freezing Rain"
## [3] "Damaging Freeze" "Early Freeze"
## [5] "Freezing Drizzle" "Freezing Drizzle & Freezing"
## [7] "Freezing Rain" "Freezing Rain & Sleet"
## [9] "Freezing Rain & Snow" "Freezing Rain Sleet &"
## [11] "Freezing Rain Sleet & Light" "Freezing Spray"
## [13] "Frost & Freeze" "Frost\\Freeze"
## [15] "Hard Freeze" "Heavy Snow & Freezing Rain"
## [17] "Heavy Snow & High Wind & Freezing" "Heavy Snow Freezing Rain"
## [19] "High Wind & Blizzard & Freezing Ra" "Late Freeze"
## [21] "Light Freezing Rain" "Light Snow & Freezing Precip"
## [23] "Sleet & Freezing Rain" "Snow & Freezing Rain"
## [25] "Snow & Sleet & Freezing Rain" "Snow Freezing Rain"
## [1]
## [1] "String event look-up: Stor from Storm Surge"
## [1] "List of potential mistmatch: "
## [1] "Blizzard & Winter Storm" "Coastal Storm"
## [3] "Dust Storm & High Wind" "Glaze & Ice Storm"
## [5] "Hail Storm" "Heavy Snow & Ice Storm"
## [7] "Heavy Snow & Winter Storm" "High Wind Dust Storm"
## [9] "Ice Storm & Flash Flood" "Ice Storm & Snow"
## [11] "Metro Storm, May 26" "Sleet & Ice Storm"
## [13] "Sleet Storm" "Snow & Ice Storm"
## [15] "Storm Force Wind" "Tropical Storm Alberto"
## [17] "Tropical Storm Dean" "Tropical Storm Gordon"
## [19] "Tropical Storm Jerry" "Wind Storm"
## [21] "Winter Storm & High Wind" "Winter Storm High Wind"
## [1]
## [1] "String event look-up: Wind from Wind Chill"
## [1] "List of potential mistmatch: "
## [1] "Blizzard & High Wind" "Cold & Wind"
## [3] "Downburst Wind" "Dry Microburst Wind"
## [5] "Dry Mircoburst Wind" "Dust Storm & High Wind"
## [7] "Flash Flood & Thunderstorm Wind" "Flash Flood Wind"
## [9] "Flood & Rain & Wind" "Flood & Strong Wind"
## [11] "Gradient Wind" "Gusty Lake Wind"
## [13] "Gusty Thunderstorm Wind" "Gusty Wind"
## [15] "Gusty Wind & Hail" "Gusty Wind & Hvy Rain"
## [17] "Gusty Wind & Rain" "Hail & Wind"
## [19] "Heavy Rain & Urban Flood Wind &" "Heavy Rain & Wind"
## [21] "Heavy Snow & High Wind" "Heavy Snow & High Wind & Flood"
## [23] "Heavy Snow & High Wind & Freezing" "Heavy Snow & Strong Wind"
## [25] "Heavy Snow & Wind" "Heavy Surf & Wind"
## [27] "High Wind &" "High Wind & Blizzard"
## [29] "High Wind & Blizzard & Freezing Ra" "High Wind & Coastal Flood"
## [31] "High Wind & Cold" "High Wind & Flooding"
## [33] "High Wind & Heavy Rain" "High Wind & Heavy Snow"
## [35] "High Wind & High Tide" "High Wind & Sea"
## [37] "High Wind & Snow" "High Wind (G40)"
## [39] "High Wind 48" "High Wind 55"
## [41] "High Wind 57" "High Wind 58"
## [43] "High Wind 63" "High Wind 66"
## [45] "High Wind 67" "High Wind 70"
## [47] "High Wind 73" "High Wind 76"
## [49] "High Wind 80" "High Wind 82"
## [51] "High Wind Damage" "High Wind Dust Storm"
## [53] "High Wind Heavy Rain" "Hurricane Opal & High Wind"
## [55] "Ice & Strong Wind" "Lightning & Thunderstorm Wind"
## [57] "Lightning & Wind" "Lightning Thunderstorm Wind"
## [59] "Microburst Wind" "Non & Severe Wind Damage"
## [61] "Non & Thunderstorm Wind" "Non Thunderstorm Wind"
## [63] "Rain & Wind" "Record Cold & High Wind"
## [65] "Snow & High Wind" "Snow & Wind"
## [67] "Storm Force Wind" "Strong Wind Gust"
## [69] "Thunderstorm Wind &" "Thunderstorm Wind & Awning"
## [71] "Thunderstorm Wind & Flash Flood" "Thunderstorm Wind & Flood"
## [73] "Thunderstorm Wind & Flooding" "Thunderstorm Wind & Funnel Cloud"
## [75] "Thunderstorm Wind & Hail" "Thunderstorm Wind & Heavy Rain"
## [77] "Thunderstorm Wind & Lightning" "Thunderstorm Wind & Tree"
## [79] "Thunderstorm Wind (41)" "Thunderstorm Wind (G35)"
## [81] "Thunderstorm Wind (G40)" "Thunderstorm Wind (G45)"
## [83] "Thunderstorm Wind 13" "Thunderstorm Wind 2"
## [85] "Thunderstorm Wind 40" "Thunderstorm Wind 45"
## [87] "Thunderstorm Wind 50" "Thunderstorm Wind 51"
## [89] "Thunderstorm Wind 52" "Thunderstorm Wind 53"
## [91] "Thunderstorm Wind 55" "Thunderstorm Wind 56"
## [93] "Thunderstorm Wind 59" "Thunderstorm Wind 59 Mph"
## [95] "Thunderstorm Wind 59 Mph." "Thunderstorm Wind 60"
## [97] "Thunderstorm Wind 60 Mph" "Thunderstorm Wind 61"
## [99] "Thunderstorm Wind 62" "Thunderstorm Wind 63 Mph"
## [101] "Thunderstorm Wind 65 Mph" "Thunderstorm Wind 65)"
## [103] "Thunderstorm Wind 65mph" "Thunderstorm Wind 69"
## [105] "Thunderstorm Wind 98 Mph" "Thunderstorm Wind Damage"
## [107] "Thunderstorm Wind Funnel Cloud" "Thunderstorm Wind G"
## [109] "Thunderstorm Wind G45" "Thunderstorm Wind G50"
## [111] "Thunderstorm Wind G51" "Thunderstorm Wind G52"
## [113] "Thunderstorm Wind G55" "Thunderstorm Wind G58"
## [115] "Thunderstorm Wind G60" "Thunderstorm Wind G61"
## [117] "Thunderstorm Wind Hail" "Thunderstorm Wind Heavy Rain"
## [119] "Thunderstorm Wind Le Cen" "Thunderstorm Wind Lightning"
## [121] "Thunderstorm Wind Shower" "Thunderstorm Wind Small Strea"
## [123] "Thunderstorm Wind Tree" "Thunderstorm Wind Urban Flood"
## [125] "Thunderstorm Wind Wind" "Thunderstorm Wind."
## [127] "Tornado, Thunderstorm Wind, Hail" "Wake Low Wind"
## [129] "Wind" "Wind & Hail"
## [131] "Wind & Wave" "Wind Advisory"
## [133] "Wind Damage" "Wind Gust"
## [135] "Wind Storm" "Winter Storm & High Wind"
## [137] "Winter Storm High Wind"
## [1]
## [1] "String event look-up: Heav from Heavy Rain"
## [1] "List of potential mistmatch: "
## [1] "Blizzard & Heavy Snow" "Heavy Mix"
## [3] "Heavy Precipatation" "Heavy Precipitation"
## [5] "Heavy Sea" "Heavy Snow &"
## [7] "Heavy Snow & Blizzard" "Heavy Snow & Blizzard & Avalanche"
## [9] "Heavy Snow & blowing Snow" "Heavy Snow & Blowing Snow"
## [11] "Heavy Snow & Freezing Rain" "Heavy Snow & High"
## [13] "Heavy Snow & High Wind" "Heavy Snow & High Wind & Flood"
## [15] "Heavy Snow & High Wind & Freezing" "Heavy Snow & Ice"
## [17] "Heavy Snow & Ice Storm" "Heavy Snow & Sleet"
## [19] "Heavy Snow & Squall" "Heavy Snow & Strong Wind"
## [21] "Heavy Snow & Wind" "Heavy Snow & Winter Storm"
## [23] "Heavy Snow Freezing Rain" "Heavy Snow Shower"
## [25] "Heavy Snow Squall" "Heavy Surf"
## [27] "Heavy Surf & High Surf" "Heavy Surf & Wind"
## [29] "Heavy Surf Coastal Flood" "Heavy Swell"
## [31] "High Wind & Heavy Snow" "Rain (Heavy)"
## [33] "Rip Current & Heavy Surf" "Rip Current Heavy Surf"
## [35] "Snow & Heavy Snow"
## [1]
## [1] "String event look-up: Heav from Heavy Snow"
## [1] "List of potential mistmatch: "
## [1] "Flash Flood & Heavy Rain" "Flood & Heavy Rain"
## [3] "Flooding & Heavy Rain" "Heavy Mix"
## [5] "Heavy Precipatation" "Heavy Precipitation"
## [7] "Heavy Rain & Flood" "Heavy Rain & Flooding"
## [9] "Heavy Rain & High Surf" "Heavy Rain & Lightning"
## [11] "Heavy Rain & Mudslide & Flood" "Heavy Rain & Severe Weather"
## [13] "Heavy Rain & Small Stream Urban" "Heavy Rain & Snow"
## [15] "Heavy Rain & Urban Flood" "Heavy Rain & Urban Flood Wind &"
## [17] "Heavy Rain & Wind" "Heavy Rain Effect"
## [19] "Heavy Sea" "Heavy Surf"
## [21] "Heavy Surf & High Surf" "Heavy Surf & Wind"
## [23] "Heavy Surf Coastal Flood" "Heavy Swell"
## [25] "High Wind & Heavy Rain" "High Wind Heavy Rain"
## [27] "Lightning & Heavy Rain" "Locally Heavy Rain"
## [29] "Rain (Heavy)" "Rip Current & Heavy Surf"
## [31] "Rip Current Heavy Surf" "Thunderstorm Wind & Heavy Rain"
## [33] "Thunderstorm Wind Heavy Rain"
## [1]
## [1] "String event look-up: High from High Surf"
## [1] "List of potential mistmatch: "
## [1] "Astronomical High Tide" "Blizzard & High Wind"
## [3] "Dust Storm & High Wind" "Heavy Snow & High"
## [5] "Heavy Snow & High Wind" "Heavy Snow & High Wind & Flood"
## [7] "Heavy Snow & High Wind & Freezing" "High"
## [9] "High Sea" "High Swell"
## [11] "High Temperature Record" "High Tide"
## [13] "High Water" "High Wave"
## [15] "High Wind &" "High Wind & Blizzard"
## [17] "High Wind & Blizzard & Freezing Ra" "High Wind & Coastal Flood"
## [19] "High Wind & Cold" "High Wind & Flooding"
## [21] "High Wind & Heavy Rain" "High Wind & Heavy Snow"
## [23] "High Wind & High Tide" "High Wind & Low Wind Chill"
## [25] "High Wind & Sea" "High Wind & Snow"
## [27] "High Wind & Wind Chill" "High Wind & Wind Chill & Blizzard"
## [29] "High Wind (G40)" "High Wind 48"
## [31] "High Wind 55" "High Wind 57"
## [33] "High Wind 58" "High Wind 63"
## [35] "High Wind 66" "High Wind 67"
## [37] "High Wind 70" "High Wind 73"
## [39] "High Wind 76" "High Wind 80"
## [41] "High Wind 82" "High Wind Damage"
## [43] "High Wind Dust Storm" "High Wind Heavy Rain"
## [45] "Highway Flooding" "Hurricane Opal & High Wind"
## [47] "Record Cold & High Wind" "Record High"
## [49] "Record High Temperature" "Snow & High Wind"
## [51] "Snow & High Wind & Wind Chill" "Wind Chill & High Wind"
## [53] "Winter Storm & High Wind" "Winter Storm High Wind"
## [1]
## [1] "String event look-up: High from High Wind"
## [1] "List of potential mistmatch: "
## [1] "Astronomical High Tide" "Heavy Rain & High Surf"
## [3] "Heavy Snow & High" "Heavy Surf & High Surf"
## [5] "High" "High Sea"
## [7] "High Surf Advisorie" "High Surf Advisory"
## [9] "High Swell" "High Temperature Record"
## [11] "High Tide" "High Water"
## [13] "High Wave" "Highway Flooding"
## [15] "Record High" "Record High Temperature"
## [1]
## [1] "String event look-up: Ice from Ice Storm"
## [1] "List of potential mistmatch: "
## [1] "Black Ice" "Falling Snow & Ice"
## [3] "Flash Flood From Ice Jam" "Glaze Ice"
## [5] "Heavy Snow & Ice" "Ice"
## [7] "Ice & Snow" "Ice & Strong Wind"
## [9] "Ice Floe" "Ice Fog"
## [11] "Ice Jam" "Ice Jam Flood (Minor"
## [13] "Ice Jam Flooding" "Ice On Road"
## [15] "Ice Pellet" "Ice Road"
## [17] "Icestorm & Blizzard" "Patchy Ice"
## [19] "Snow & Ice"
## [1]
## [1] "String event look-up: Free from Freeze"
## [1] "List of potential mistmatch: "
## [1] "Blizzard & Freezing Rain" "Freezing Drizzle"
## [3] "Freezing Drizzle & Freezing" "Freezing Rain"
## [5] "Freezing Rain & Sleet" "Freezing Rain & Snow"
## [7] "Freezing Rain Sleet &" "Freezing Rain Sleet & Light"
## [9] "Freezing Spray" "Heavy Snow & Freezing Rain"
## [11] "Heavy Snow & High Wind & Freezing" "Heavy Snow Freezing Rain"
## [13] "High Wind & Blizzard & Freezing Ra" "Light Freezing Rain"
## [15] "Light Snow & Freezing Precip" "Sleet & Freezing Rain"
## [17] "Snow & Freezing Rain" "Snow & Sleet & Freezing Rain"
## [19] "Snow Freezing Rain"
## [1]
## [1] "String event look-up: Floo from Flood"
## [1] "List of potential mistmatch: "
## [1] "Breakup Flooding" "Flooding"
## [3] "Flooding & Heavy Rain" "Hail Flooding"
## [5] "Heavy Rain & Flooding" "High Wind & Flooding"
## [7] "Highway Flooding" "Ice Jam Flooding"
## [9] "Minor Flooding" "Mud Slide Urban Flooding"
## [11] "River Flooding" "Small Stream & Urban Floodin"
## [13] "Small Stream Flooding" "Snowmelt Flooding"
## [15] "Stream Flooding" "Street Flooding"
## [17] "Thunderstorm Wind & Flooding" "Tidal Flooding"
## [19] "Urban & Small Flooding" "Urban & Small Stream Floodin"
## [21] "Urban & Small Stream Flooding" "Urban & Street Flooding"
## [23] "Urban Flooding"
# [1] "String event look-up: Free from Freezing Fog"
# [1] "List of potential mistmatch: "
# [1] "Agricultural Freeze" "Blizzard & Freezing Rain" "Damaging Freeze" "Early Freeze"
# [5] "Freezing Drizzle" "Freezing Drizzle & Freezing" "Freezing Rain" "Freezing Rain & Sleet"
# [9] "Freezing Rain & Snow" "Freezing Rain Sleet &" "Freezing Rain Sleet & Light" "Freezing Spray"
# [13] "Frost & Freeze" "Frost\\Freeze" "Hard Freeze" "Heavy Snow & Freezing Rain"
# [17] "Heavy Snow & High Wind & Freezing" "Heavy Snow Freezing Rain" "High Wind & Blizzard & Freezing Ra" "Late Freeze"
# [21] "Light Freezing Rain" "Light Snow & Freezing Precip" "Sleet & Freezing Rain" "Snow & Freezing Rain"
# [25] "Snow & Sleet & Freezing Rain" "Snow Freezing Rain"
recode_list <- paste0("\\b",unique(c(
"Freezing Drizzle"
)),"\\b")
recode_to <- unique(c("Freezing Fog"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
# [1] "String event look-up: Heav from Heavy Rain"
# [1] "List of potential mistmatch: "
# [1] "Blizzard & Heavy Snow" "Heavy Mix" "Heavy Precipatation" "Heavy Precipitation"
# [5] "Heavy Sea" "Heavy Snow &" "Heavy Snow & Blizzard" "Heavy Snow & Blizzard & Avalanche"
# [9] "Heavy Snow & blowing Snow" "Heavy Snow & Blowing Snow" "Heavy Snow & Freezing Rain" "Heavy Snow & High"
# [13] "Heavy Snow & High Wind" "Heavy Snow & High Wind & Flood" "Heavy Snow & High Wind & Freezing" "Heavy Snow & Ice"
# [17] "Heavy Snow & Ice Storm" "Heavy Snow & Sleet" "Heavy Snow & Squall" "Heavy Snow & Strong Wind"
# [21] "Heavy Snow & Wind" "Heavy Snow & Winter Storm" "Heavy Snow Freezing Rain" "Heavy Snow Shower"
# [25] "Heavy Snow Squall" "Heavy Surf" "Heavy Surf & High Surf" "Heavy Surf & Wind"
# [29] "Heavy Surf Coastal Flood" "Heavy Swell" "High Wind & Heavy Snow" "Rain (Heavy)"
# [33] "Rip Current & Heavy Surf" "Rip Current Heavy Surf" "Snow & Heavy Snow"
recode_list <- paste0("\\b",unique(c(
"Rain (Heavy)"
)),"\\b")
recode_to <- unique(c("Heavy Rain"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
# [1] "String event look-up: Ice from Ice Storm"
# [1] "List of potential mistmatch: "
# [1] "Black Ice" "Falling Snow & Ice" "Flash Flood From Ice Jam" "Glaze Ice" "Heavy Snow & Ice"
# [6] "Ice" "Ice & Snow" "Ice & Strong Wind" "Ice Floe" "Ice Fog"
# [11] "Ice Jam" "Ice Jam Flood (Minor" "Ice Jam Flooding" "Ice On Road" "Ice Pellet"
# [16] "Ice Road" "Icestorm & Blizzard" "Patchy Ice" "Snow & Ice"
recode_list <- paste0("\\b",unique(c(
"Black Ice", "Ice Floe", "Glaze Ice", "Ice Pellet", "Icestorm", "Freezing Rain", "Freezing Spray", "Ice On Road", "Ice Road", "Patchy Ice"
)),"\\b")
recode_to <- unique(c("Ice Storm"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
recode_list <- paste0("\\b",unique(c(
"Ice Fog", "Freezing Drizzle"
)),"\\b")
recode_to <- unique(c("Freezing Fog"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
# [1] "String event look-up: Floo from Flood"
# [1] "List of potential mistmatch: "
# [1] "Breakup Flooding" "Cstl Flooding & Erosion" "Flash Floooding" "Flooding"
# [5] "Flooding & Heavy Rain" "Hail Flooding" "Heavy Rain & Flooding" "High Wind & Flooding"
# [9] "Highway Flooding" "Ice Jam Flooding" "Minor Flooding" "Mud Slide Urban Flooding"
# [13] "River Flooding" "Small Stream & Urban Floodin" "Small Stream Flooding" "Snowmelt Flooding"
# [17] "Stream Flooding" "Street Flooding" "Thunderstorm Wind & Flooding" "Tidal Flooding"
# [21] "Urban & Small Flooding" "Urban & Small Stream Floodin" "Urban & Small Stream Flooding" "Urban & Street Flooding"
# [25] "Urban Flooding"
recode_list <- paste0("\\b",unique(c(
"Flooding"
)),"\\b")
recode_to <- unique(c("Flood"))
data[,copy_EVTYPE := gsub(paste(recode_list,collapse = "|"),recode_to, copy_EVTYPE)]
rm(list = c("p","q","i","recode_list","recode_to"))
levels_copy_EVTYPE <- levels(as.factor(data$copy_EVTYPE))
levels_copy_EVTYPE
## [1] "?" "Abnormal Warmth"
## [3] "Abnormally Dry" "Abnormally Wet"
## [5] "Accumulated Snowfall" "Agricultural Freeze"
## [7] "Apache County" "Astronomical High Tide"
## [9] "Astronomical Low Tide" "Avalanche"
## [11] "Beach Erosin" "Beach Erosion"
## [13] "Beach Erosion & Coastal Flood" "Beach Flood"
## [15] "Below Normal Precipitation" "Bitter Wind Chill"
## [17] "Bitter Wind Chill Temperature" "Blizzard"
## [19] "Blizzard & Extreme Cold" "Blizzard & Heavy Snow"
## [21] "Blizzard & High Wind" "Blizzard & Ice Storm"
## [23] "Blizzard & Winter Storm" "Blizzard Summary"
## [25] "Blizzard Weather" "Blow & Out Tide"
## [27] "Blowing Snow" "Blowing Snow & Extreme Cold"
## [29] "Breakup Flood" "Brush Fire"
## [31] "Coastal Erosion" "Coastal Flood"
## [33] "Coastal Flood & Erosion" "Coastal Storm"
## [35] "Coastal Surge" "Coastalstorm"
## [37] "Cold" "Cold & Frost"
## [39] "Cold & Snow" "Cold & Wet Condition"
## [41] "Cold & Wind" "Cold & Wind Chill"
## [43] "Cold Air Funnel Cloud" "Cold Air Tornado"
## [45] "Cold Temperature" "Cold Wave"
## [47] "Cold Weather" "Cold Wind Chill Temperature"
## [49] "Cool & Wet" "Cool Spell"
## [51] "Dam Break" "Dam Failure"
## [53] "Damaging Freeze" "Deep Hail"
## [55] "Dense Fog" "Dense Smoke"
## [57] "Downburst" "Downburst Wind"
## [59] "Driest Month" "Drifting Snow"
## [61] "Drought" "Drought & Excessive Heat"
## [63] "Drowning" "Dry"
## [65] "Dry Condition" "Dry Hot Weather"
## [67] "Dry Microburst" "Dry Microburst 50"
## [69] "Dry Microburst 53" "Dry Microburst 58"
## [71] "Dry Microburst 61" "Dry Microburst 84"
## [73] "Dry Microburst Wind" "Dry Mircoburst Wind"
## [75] "Dry Pattern" "Dry Spell"
## [77] "Dry Weather" "Drynes"
## [79] "Dust Devil" "Dust Devil Waterspout"
## [81] "Dust Storm" "Dust Storm & High Wind"
## [83] "Early Freeze" "Early Frost"
## [85] "Early Rain" "Early Snow"
## [87] "Early Snowfall" "Erosion & Coastal Flood"
## [89] "Excessive" "Excessive Cold"
## [91] "Excessive Heat" "Excessive Heat & Drought"
## [93] "Excessive Precipitation" "Excessive Rain"
## [95] "Excessive Rainfall" "Excessive Snow"
## [97] "Excessive Wetnes" "Excessively Dry"
## [99] "Extended Cold" "Extreme Cold"
## [101] "Extreme Cold & Blowing Sno" "Extreme Cold & Wind Chill"
## [103] "Extreme Heat" "Extremely Wet"
## [105] "Falling Snow & Ice" "First Frost"
## [107] "First Snow" "Flash Flood"
## [109] "Flash Flood &" "Flash Flood & Flood"
## [111] "Flash Flood & Heavy Rain" "Flash Flood & Landslide"
## [113] "Flash Flood & Street" "Flash Flood & Thunderstorm Wind"
## [115] "Flash Flood Flood" "Flash Flood From Ice Jam"
## [117] "Flash Flood Landslide" "Flash Flood Wind"
## [119] "Flood" "Flood & Flash Flood"
## [121] "Flood & Heavy Rain" "Flood & Rain & Wind"
## [123] "Flood & River Flood" "Flood & Strong Wind"
## [125] "Flood Flash Flood" "Flood Watch &"
## [127] "Fog" "Fog & Cold Temperature"
## [129] "Forest Fire" "Freeze"
## [131] "Freezing Fog" "Freezing Fog & Freezing"
## [133] "Frost" "Frost & Freeze"
## [135] "Frost\\Freeze" "Funnel Cloud"
## [137] "Funnel Cloud Cloud" "Funnel Cloud Cloud & Hail"
## [139] "Funnel Cloud Cloud." "Glaze"
## [141] "Glaze & Ice Storm" "Gradient Wind"
## [143] "Gras Fire" "Ground Blizzard"
## [145] "Gustnado" "Gustnado &"
## [147] "Gusty Lake Wind" "Gusty Thunderstorm Wind"
## [149] "Gusty Wind" "Gusty Wind & Hail"
## [151] "Gusty Wind & Hvy Rain" "Gusty Wind & Rain"
## [153] "Hail" "Hail & Icy Road"
## [155] "Hail & Wind" "Hail 0.75"
## [157] "Hail 0.88" "Hail 075"
## [159] "Hail 088" "Hail 1.00"
## [161] "Hail 1.75" "Hail 1.75)"
## [163] "Hail 100" "Hail 125"
## [165] "Hail 150" "Hail 175"
## [167] "Hail 200" "Hail 225"
## [169] "Hail 275" "Hail 450"
## [171] "Hail 75" "Hail 80"
## [173] "Hail 88" "Hail Aloft"
## [175] "Hail Damage" "Hail Flood"
## [177] "Hail Storm" "Hail(0.75)"
## [179] "Hard Freeze" "Hazardou Surf"
## [181] "Heat" "Heat & Drought"
## [183] "Heat Drought" "Heat Wave"
## [185] "Heat Wave Drought" "Heavy Mix"
## [187] "Heavy Precipatation" "Heavy Precipitation"
## [189] "Heavy Rain" "Heavy Rain & Flood"
## [191] "Heavy Rain & High Surf" "Heavy Rain & Lightning"
## [193] "Heavy Rain & Mudslide & Flood" "Heavy Rain & Severe Weather"
## [195] "Heavy Rain & Small Stream Urban" "Heavy Rain & Snow"
## [197] "Heavy Rain & Urban Flood" "Heavy Rain & Urban Flood Wind &"
## [199] "Heavy Rain & Wind" "Heavy Rain Effect"
## [201] "Heavy Sea" "Heavy Snow"
## [203] "Heavy Snow &" "Heavy Snow & Blizzard"
## [205] "Heavy Snow & Blizzard & Avalanche" "Heavy Snow & blowing Snow"
## [207] "Heavy Snow & Blowing Snow" "Heavy Snow & High"
## [209] "Heavy Snow & High Wind" "Heavy Snow & High Wind & Flood"
## [211] "Heavy Snow & High Wind & Freezing" "Heavy Snow & Ice"
## [213] "Heavy Snow & Ice Storm" "Heavy Snow & Sleet"
## [215] "Heavy Snow & Squall" "Heavy Snow & Strong Wind"
## [217] "Heavy Snow & Wind" "Heavy Snow & Winter Storm"
## [219] "Heavy Snow Ice Storm" "Heavy Snow Shower"
## [221] "Heavy Snow Squall" "Heavy Surf"
## [223] "Heavy Surf & High Surf" "Heavy Surf & Wind"
## [225] "Heavy Surf Coastal Flood" "Heavy Swell"
## [227] "High" "High Sea"
## [229] "High Surf" "High Surf Advisorie"
## [231] "High Surf Advisory" "High Swell"
## [233] "High Temperature Record" "High Tide"
## [235] "High Water" "High Wave"
## [237] "High Wind" "High Wind &"
## [239] "High Wind & Blizzard" "High Wind & Blizzard & Freezing Ra"
## [241] "High Wind & Coastal Flood" "High Wind & Cold"
## [243] "High Wind & Flood" "High Wind & Heavy Rain"
## [245] "High Wind & Heavy Snow" "High Wind & High Tide"
## [247] "High Wind & Low Wind Chill" "High Wind & Sea"
## [249] "High Wind & Snow" "High Wind & Wind Chill"
## [251] "High Wind & Wind Chill & Blizzard" "High Wind (G40)"
## [253] "High Wind 48" "High Wind 55"
## [255] "High Wind 57" "High Wind 58"
## [257] "High Wind 63" "High Wind 66"
## [259] "High Wind 67" "High Wind 70"
## [261] "High Wind 73" "High Wind 76"
## [263] "High Wind 80" "High Wind 82"
## [265] "High Wind Damage" "High Wind Dust Storm"
## [267] "High Wind Heavy Rain" "Highway Flood"
## [269] "Hot & Dry" "Hot & Dry Pattern"
## [271] "Hot Pattern" "Hot Spell"
## [273] "Hot Weather" "Hurricane"
## [275] "Hurricane & Generated Swell" "Hurricane & Typhoon"
## [277] "Hurricane Edouard" "Hurricane Emily"
## [279] "Hurricane Erin" "Hurricane Felix"
## [281] "Hurricane Gordon" "Hurricane Opal"
## [283] "Hurricane Opal & High Wind" "Hvy Rain"
## [285] "Hyperthermia & Exposure" "Hypothermia"
## [287] "Hypothermia & Exposure" "Ice"
## [289] "Ice & Snow" "Ice & Strong Wind"
## [291] "Ice Jam" "Ice Jam Flood"
## [293] "Ice Jam Flood (Minor" "Ice Storm"
## [295] "Ice Storm & Blizzard" "Ice Storm & Flash Flood"
## [297] "Ice Storm & Sleet" "Ice Storm & Snow"
## [299] "Ice Storm Sleet &" "Ice Storm Sleet & Light"
## [301] "Icy Road" "Lack Of Snow"
## [303] "Lake-Effect Snow" "Lakeshore Flood"
## [305] "Landslide" "Landslide & Urban Flood"
## [307] "Landslump" "Landspout"
## [309] "Large Wall Cloud" "Late & Season Snowfall"
## [311] "Late Freeze" "Late Season Hail"
## [313] "Late Season Snow" "Late Season Snowfall"
## [315] "Late Snow" "Light Ice Storm"
## [317] "Light Snow" "Light Snow & Flurrie"
## [319] "Light Snow & Freezing Precip" "Light Snow & Sleet"
## [321] "Light Snowfall" "Lightning"
## [323] "Lightning & Heavy Rain" "Lightning & Thunderstorm Wind"
## [325] "Lightning & Wind" "Lightning Damage"
## [327] "Lightning Fire" "Lightning Injury"
## [329] "Lightning Thunderstorm Wind" "Lightning Wauseon"
## [331] "Lightning." "Ligntning"
## [333] "Local Flash Flood" "Local Flood"
## [335] "Locally Heavy Rain" "Low Temperature"
## [337] "Low Temperature Record" "Low Wind Chill"
## [339] "Major Flood" "Marine Accident"
## [341] "Marine Hail" "Marine High Wind"
## [343] "Marine Mishap" "Marine Strong Wind"
## [345] "Marine Thunderstorm Wind" "Metro Storm, May 26"
## [347] "Microburst" "Microburst Wind"
## [349] "Mild & Dry Pattern" "Mild Pattern"
## [351] "Minor Flood" "Mixed Precip"
## [353] "Mixed Precipitation" "Moderate Snow"
## [355] "Moderate Snowfall" "Monthly Precipitation"
## [357] "Monthly Rainfall" "Monthly Snowfall"
## [359] "Monthly Temperature" "Mountain Snow"
## [361] "Mud & Rock Slide" "Mud Slide"
## [363] "Mud Slide Urban Flood" "Mudslide"
## [365] "Mudslide & Landslide" "Near Record Snow"
## [367] "No Severe Weather" "Non & Severe Wind Damage"
## [369] "Non & Thunderstorm Wind" "Non Severe Hail"
## [371] "Non Thunderstorm Wind" "None"
## [373] "Normal Precipitation" "Northern Light"
## [375] "Other" "Patchy Dense Fog"
## [377] "Prolong Cold" "Prolong Cold & Snow"
## [379] "Prolong Warmth" "Prolonged Rain"
## [381] "Rain" "Rain & Snow"
## [383] "Rain & Wind" "Rain (Heavy)"
## [385] "Rain Damage" "Rainstorm"
## [387] "Rapidly Rising Water" "Record & Excessive Heat"
## [389] "Record & Excessive Rainfall" "Record Cold"
## [391] "Record Cold & Frost" "Record Cold & High Wind"
## [393] "Record Cool" "Record Dry Month"
## [395] "Record Drynes" "Record Heat"
## [397] "Record Heat Wave" "Record High"
## [399] "Record High Temperature" "Record Low"
## [401] "Record Low Rainfall" "Record May Snow"
## [403] "Record Precipitation" "Record Rainfall"
## [405] "Record Snow" "Record Snow & Cold"
## [407] "Record Snowfall" "Record Temperature"
## [409] "Record Warm" "Record Warm Temp."
## [411] "Record Warmth" "Record Winter Snow"
## [413] "Red Flag Criteria" "Red Flag Fire Wx"
## [415] "Remnant Of Floyd" "Rip Current"
## [417] "Rip Current & Heavy Surf" "Rip Current Heavy Surf"
## [419] "River & Stream Flood" "River Flood"
## [421] "Rock Slide" "Rogue Wave"
## [423] "Rotating Wall Cloud" "Rough Sea"
## [425] "Rough Surf" "Rural Flood"
## [427] "Seasonal Snowfall" "Seiche"
## [429] "Severe Cold" "Severe Turbulence"
## [431] "Sleet" "Sleet & Ice Storm"
## [433] "Sleet & Rain & Snow" "Sleet & Snow"
## [435] "Sleet Storm" "Small Hail"
## [437] "Small Stream" "Small Stream &"
## [439] "Small Stream & Urban Flood" "Small Stream & Urban Floodin"
## [441] "Small Stream Flood" "Small Stream Urban Flood"
## [443] "Sml Stream Fld" "Smoke"
## [445] "Snow" "Snow & Bitter Cold"
## [447] "Snow & Blowing Snow" "Snow & Cold"
## [449] "Snow & Heavy Snow" "Snow & High Wind"
## [451] "Snow & High Wind & Wind Chill" "Snow & Ice"
## [453] "Snow & Ice Storm" "Snow & Rain"
## [455] "Snow & Rain & Sleet" "Snow & Sleet"
## [457] "Snow & Sleet & Ice Storm" "Snow & Sleet & Rain"
## [459] "Snow & Wind" "Snow Accumulation"
## [461] "Snow Advisory" "Snow Drought"
## [463] "Snow Ice Storm" "Snow Shower"
## [465] "Snow Sleet" "Snow Squall"
## [467] "Snow\\Cold" "Snowfall Record"
## [469] "Snowmelt Flood" "Snowstorm"
## [471] "Southeast" "Storm Force Wind"
## [473] "Storm Surge" "Storm Surge & Tide"
## [475] "Stream Flood" "Street Flood"
## [477] "Strong Wind" "Strong Wind Gust"
## [479] "Summary August 10" "Summary August 11"
## [481] "Summary August 17" "Summary August 2 & 3"
## [483] "Summary August 21" "Summary August 28"
## [485] "Summary August 4" "Summary August 7"
## [487] "Summary August 9" "Summary Jan 17"
## [489] "Summary July 23 & 24" "Summary June 18 & 19"
## [491] "Summary June 5 & 6" "Summary June 6"
## [493] "Summary Of April 12" "Summary Of April 13"
## [495] "Summary Of April 21" "Summary Of April 27"
## [497] "Summary Of April 3rd" "Summary Of August 1"
## [499] "Summary Of July 11" "Summary Of July 2"
## [501] "Summary Of July 22" "Summary Of July 26"
## [503] "Summary Of July 29" "Summary Of July 3"
## [505] "Summary Of June 10" "Summary Of June 11"
## [507] "Summary Of June 12" "Summary Of June 13"
## [509] "Summary Of June 15" "Summary Of June 16"
## [511] "Summary Of June 18" "Summary Of June 23"
## [513] "Summary Of June 24" "Summary Of June 3"
## [515] "Summary Of June 30" "Summary Of June 4"
## [517] "Summary Of June 6" "Summary Of March 14"
## [519] "Summary Of March 23" "Summary Of March 24"
## [521] "Summary Of March 24 & 25" "Summary Of March 27"
## [523] "Summary Of March 29" "Summary Of May 10"
## [525] "Summary Of May 13" "Summary Of May 14"
## [527] "Summary Of May 22" "Summary Of May 22 Am"
## [529] "Summary Of May 22 Pm" "Summary Of May 26 Am"
## [531] "Summary Of May 26 Pm" "Summary Of May 31 Am"
## [533] "Summary Of May 31 Pm" "Summary Of May 9 & 10"
## [535] "Summary Sept. 25 & 26" "Summary September 20"
## [537] "Summary September 23" "Summary September 3"
## [539] "Summary September 4" "Summary: Nov. 16"
## [541] "Summary: Nov. 6 & 7" "Summary: Oct. 20 & 21"
## [543] "Summary: October 31" "Summary: Sept. 18"
## [545] "Temperature Record" "Thunderstorm Wind"
## [547] "Thunderstorm Wind &" "Thunderstorm Wind & Awning"
## [549] "Thunderstorm Wind & Flash Flood" "Thunderstorm Wind & Flood"
## [551] "Thunderstorm Wind & Funnel Cloud" "Thunderstorm Wind & Hail"
## [553] "Thunderstorm Wind & Heavy Rain" "Thunderstorm Wind & Lightning"
## [555] "Thunderstorm Wind & Tree" "Thunderstorm Wind (41)"
## [557] "Thunderstorm Wind (G35)" "Thunderstorm Wind (G40)"
## [559] "Thunderstorm Wind (G45)" "Thunderstorm Wind 13"
## [561] "Thunderstorm Wind 2" "Thunderstorm Wind 40"
## [563] "Thunderstorm Wind 45" "Thunderstorm Wind 50"
## [565] "Thunderstorm Wind 51" "Thunderstorm Wind 52"
## [567] "Thunderstorm Wind 53" "Thunderstorm Wind 55"
## [569] "Thunderstorm Wind 56" "Thunderstorm Wind 59"
## [571] "Thunderstorm Wind 59 Mph" "Thunderstorm Wind 59 Mph."
## [573] "Thunderstorm Wind 60" "Thunderstorm Wind 60 Mph"
## [575] "Thunderstorm Wind 61" "Thunderstorm Wind 62"
## [577] "Thunderstorm Wind 63 Mph" "Thunderstorm Wind 65 Mph"
## [579] "Thunderstorm Wind 65)" "Thunderstorm Wind 65mph"
## [581] "Thunderstorm Wind 69" "Thunderstorm Wind 98 Mph"
## [583] "Thunderstorm Wind Damage" "Thunderstorm Wind Funnel Cloud"
## [585] "Thunderstorm Wind G" "Thunderstorm Wind G45"
## [587] "Thunderstorm Wind G50" "Thunderstorm Wind G51"
## [589] "Thunderstorm Wind G52" "Thunderstorm Wind G55"
## [591] "Thunderstorm Wind G58" "Thunderstorm Wind G60"
## [593] "Thunderstorm Wind G61" "Thunderstorm Wind Hail"
## [595] "Thunderstorm Wind Heavy Rain" "Thunderstorm Wind Le Cen"
## [597] "Thunderstorm Wind Lightning" "Thunderstorm Wind Shower"
## [599] "Thunderstorm Wind Small Strea" "Thunderstorm Wind Tree"
## [601] "Thunderstorm Wind Urban Flood" "Thunderstorm Wind Wind"
## [603] "Thunderstorm Wind." "Tidal Flood"
## [605] "Tornado" "Tornado & Waterspout"
## [607] "Tornado Debris Flow" "Tornado F0"
## [609] "Tornado F1" "Tornado F2"
## [611] "Tornado F3" "Tornado, Thunderstorm Wind, Hail"
## [613] "Torrential Rain" "Torrential Rainfall"
## [615] "Tropical Depression" "Tropical Storm"
## [617] "Tropical Storm Alberto" "Tropical Storm Dean"
## [619] "Tropical Storm Gordon" "Tropical Storm Jerry"
## [621] "Tsunami" "Typhoon"
## [623] "Unseasonable Cold" "Unseasonably Cold"
## [625] "Unseasonably Cool" "Unseasonably Cool & Wet"
## [627] "Unseasonably Dry" "Unseasonably Hot"
## [629] "Unseasonably Warm" "Unseasonably Warm & Dry"
## [631] "Unseasonably Warm & Wet" "Unseasonably Warm Year"
## [633] "Unseasonably Wet" "Unseasonal Low Temp"
## [635] "Unseasonal Rain" "Unusual & Record Warmth"
## [637] "Unusual Warmth" "Unusually Cold"
## [639] "Unusually Late Snow" "Unusually Warm"
## [641] "Urban & Small" "Urban & Small Flood"
## [643] "Urban & Small Stream" "Urban & Small Stream Flood"
## [645] "Urban & Small Stream Floodin" "Urban & Small Strm Fldg"
## [647] "Urban & Sml Stream Fld" "Urban & Sml Stream Fldg"
## [649] "Urban & Street Flood" "Urban Flood"
## [651] "Urban Flood Landslide" "Urban Small"
## [653] "Urban Small Stream Flood" "Very Dry"
## [655] "Very Warm" "Vog"
## [657] "Volcanic Ash" "Volcanic Ash Plume"
## [659] "Wake Low Wind" "Wall Cloud"
## [661] "Wall Cloud & Funnel Cloud Cloud" "Warm Dry Condition"
## [663] "Warm Weather" "Waterspout"
## [665] "Waterspout &" "Waterspout & Tornado"
## [667] "Waterspout Funnel Cloud Cloud" "Waterspout Tornado"
## [669] "Wayterspout" "Wet Micoburst"
## [671] "Wet Microburst" "Wet Month"
## [673] "Wet Snow" "Wet Weather"
## [675] "Wet Year" "Whirlwind"
## [677] "Wildfire" "Wind"
## [679] "Wind & Hail" "Wind & Wave"
## [681] "Wind Advisory" "Wind Chill"
## [683] "Wind Chill & High Wind" "Wind Damage"
## [685] "Wind Gust" "Wind Storm"
## [687] "Winter Mix" "Winter Storm"
## [689] "Winter Storm & High Wind" "Winter Storm High Wind"
## [691] "Winter Weather" "Winter Weather & Mix"
## [693] "Winter Weather Mix" "Wintery Mix"
## [695] "Wintry Mix" "Wnd"
## Drop some lines that start with summary or ?
data <- data[!grep("^Summary",copy_EVTYPE),][!grep("\\?",copy_EVTYPE),]
## Create new events list (going from bigger to smaller)
data[,clean_event := ""]
for (i in sorted_list_of_possible_events) {
data[grepl(i,copy_EVTYPE) & clean_event == "",clean_event := i]
}
data[,clean_event := as.factor(clean_event)]
levels(droplevels(data$clean_event))
## [1] "" "Astronomical Low Tide"
## [3] "Avalanche" "Blizzard"
## [5] "Coastal Flood" "Cold"
## [7] "Debris Flow" "Dense Fog"
## [9] "Dense Smoke" "Drought"
## [11] "Dust Devil" "Dust Storm"
## [13] "Excessive Heat" "Extreme Cold"
## [15] "Flash Flood" "Flood"
## [17] "Freeze" "Freezing Fog"
## [19] "Frost" "Funnel Cloud"
## [21] "Hail" "Heat"
## [23] "Heavy Rain" "Heavy Snow"
## [25] "High Surf" "High Wind"
## [27] "Hurricane" "Ice Storm"
## [29] "Lake-Effect Snow" "Lakeshore Flood"
## [31] "Lightning" "Marine Hail"
## [33] "Marine High Wind" "Marine Strong Wind"
## [35] "Marine Thunderstorm Wind" "Rip Current"
## [37] "Seiche" "Sleet"
## [39] "Storm Surge" "Strong Wind"
## [41] "Thunderstorm Wind" "Tide"
## [43] "Tornado" "Tropical Depression"
## [45] "Tropical Storm" "Tsunami"
## [47] "Typhoon" "Volcanic Ash"
## [49] "Waterspout" "Wildfire"
## [51] "Wind Chill" "Winter Storm"
## [53] "Winter Weather"
## Extract unmatched events
wrong_event_data <- data[clean_event == "", .(copy_EVTYPE)]
levels(droplevels(as.factor(wrong_event_data$copy_EVTYPE)))
## [1] "Abnormal Warmth" "Abnormally Dry"
## [3] "Abnormally Wet" "Accumulated Snowfall"
## [5] "Apache County" "Beach Erosin"
## [7] "Beach Erosion" "Below Normal Precipitation"
## [9] "Blowing Snow" "Brush Fire"
## [11] "Coastal Erosion" "Coastal Storm"
## [13] "Coastal Surge" "Coastalstorm"
## [15] "Cool & Wet" "Cool Spell"
## [17] "Dam Break" "Dam Failure"
## [19] "Downburst" "Downburst Wind"
## [21] "Driest Month" "Drifting Snow"
## [23] "Drowning" "Dry"
## [25] "Dry Condition" "Dry Hot Weather"
## [27] "Dry Microburst" "Dry Microburst 50"
## [29] "Dry Microburst 53" "Dry Microburst 58"
## [31] "Dry Microburst 61" "Dry Microburst 84"
## [33] "Dry Microburst Wind" "Dry Mircoburst Wind"
## [35] "Dry Pattern" "Dry Spell"
## [37] "Dry Weather" "Drynes"
## [39] "Early Rain" "Early Snow"
## [41] "Early Snowfall" "Excessive"
## [43] "Excessive Precipitation" "Excessive Rain"
## [45] "Excessive Rainfall" "Excessive Snow"
## [47] "Excessive Wetnes" "Excessively Dry"
## [49] "Extremely Wet" "Falling Snow & Ice"
## [51] "First Snow" "Fog"
## [53] "Forest Fire" "Glaze"
## [55] "Gradient Wind" "Gras Fire"
## [57] "Gustnado" "Gustnado &"
## [59] "Gusty Lake Wind" "Gusty Wind"
## [61] "Gusty Wind & Hvy Rain" "Gusty Wind & Rain"
## [63] "Hazardou Surf" "Heavy Mix"
## [65] "Heavy Precipatation" "Heavy Precipitation"
## [67] "Heavy Sea" "Heavy Surf"
## [69] "Heavy Surf & Wind" "Heavy Swell"
## [71] "High" "High Sea"
## [73] "High Swell" "High Temperature Record"
## [75] "High Water" "High Wave"
## [77] "Hot & Dry" "Hot & Dry Pattern"
## [79] "Hot Pattern" "Hot Spell"
## [81] "Hot Weather" "Hvy Rain"
## [83] "Hyperthermia & Exposure" "Hypothermia"
## [85] "Hypothermia & Exposure" "Ice"
## [87] "Ice & Snow" "Ice Jam"
## [89] "Icy Road" "Lack Of Snow"
## [91] "Landslide" "Landslump"
## [93] "Landspout" "Large Wall Cloud"
## [95] "Late & Season Snowfall" "Late Season Snow"
## [97] "Late Season Snowfall" "Late Snow"
## [99] "Light Snow" "Light Snow & Flurrie"
## [101] "Light Snow & Freezing Precip" "Light Snowfall"
## [103] "Ligntning" "Low Temperature"
## [105] "Low Temperature Record" "Marine Accident"
## [107] "Marine Mishap" "Metro Storm, May 26"
## [109] "Microburst" "Microburst Wind"
## [111] "Mild & Dry Pattern" "Mild Pattern"
## [113] "Mixed Precip" "Mixed Precipitation"
## [115] "Moderate Snow" "Moderate Snowfall"
## [117] "Monthly Precipitation" "Monthly Rainfall"
## [119] "Monthly Snowfall" "Monthly Temperature"
## [121] "Mountain Snow" "Mud & Rock Slide"
## [123] "Mud Slide" "Mudslide"
## [125] "Mudslide & Landslide" "Near Record Snow"
## [127] "No Severe Weather" "Non & Severe Wind Damage"
## [129] "None" "Normal Precipitation"
## [131] "Northern Light" "Other"
## [133] "Prolong Warmth" "Prolonged Rain"
## [135] "Rain" "Rain & Snow"
## [137] "Rain & Wind" "Rain (Heavy)"
## [139] "Rain Damage" "Rainstorm"
## [141] "Rapidly Rising Water" "Record & Excessive Rainfall"
## [143] "Record Cool" "Record Dry Month"
## [145] "Record Drynes" "Record High"
## [147] "Record High Temperature" "Record Low"
## [149] "Record Low Rainfall" "Record May Snow"
## [151] "Record Precipitation" "Record Rainfall"
## [153] "Record Snow" "Record Snowfall"
## [155] "Record Temperature" "Record Warm"
## [157] "Record Warm Temp." "Record Warmth"
## [159] "Record Winter Snow" "Red Flag Criteria"
## [161] "Red Flag Fire Wx" "Remnant Of Floyd"
## [163] "Rock Slide" "Rogue Wave"
## [165] "Rotating Wall Cloud" "Rough Sea"
## [167] "Rough Surf" "Seasonal Snowfall"
## [169] "Severe Turbulence" "Small Stream"
## [171] "Small Stream &" "Sml Stream Fld"
## [173] "Smoke" "Snow"
## [175] "Snow & Blowing Snow" "Snow & Ice"
## [177] "Snow & Rain" "Snow & Wind"
## [179] "Snow Accumulation" "Snow Advisory"
## [181] "Snow Shower" "Snow Squall"
## [183] "Snowfall Record" "Snowstorm"
## [185] "Southeast" "Storm Force Wind"
## [187] "Temperature Record" "Torrential Rain"
## [189] "Torrential Rainfall" "Unseasonably Cool"
## [191] "Unseasonably Cool & Wet" "Unseasonably Dry"
## [193] "Unseasonably Hot" "Unseasonably Warm"
## [195] "Unseasonably Warm & Dry" "Unseasonably Warm & Wet"
## [197] "Unseasonably Warm Year" "Unseasonably Wet"
## [199] "Unseasonal Low Temp" "Unseasonal Rain"
## [201] "Unusual & Record Warmth" "Unusual Warmth"
## [203] "Unusually Late Snow" "Unusually Warm"
## [205] "Urban & Small" "Urban & Small Stream"
## [207] "Urban & Small Strm Fldg" "Urban & Sml Stream Fld"
## [209] "Urban & Sml Stream Fldg" "Urban Small"
## [211] "Very Dry" "Very Warm"
## [213] "Vog" "Wake Low Wind"
## [215] "Wall Cloud" "Warm Dry Condition"
## [217] "Warm Weather" "Wayterspout"
## [219] "Wet Micoburst" "Wet Microburst"
## [221] "Wet Month" "Wet Snow"
## [223] "Wet Weather" "Wet Year"
## [225] "Whirlwind" "Wind"
## [227] "Wind & Wave" "Wind Advisory"
## [229] "Wind Damage" "Wind Gust"
## [231] "Wind Storm" "Winter Mix"
## [233] "Wintery Mix" "Wintry Mix"
## [235] "Wnd"
## estimate impact of hard to categorized labelled data
(nrow(wrong_event_data)/original_size)
## [1] 0.008590298
## wrongfully labelled data represent lesss than 1% of sample...
data[clean_event == "", clean_event := "Hard to categorize"]
## Some categories are synomyms... recode clean_event
data[,clean_event := gsub("\\bExtreme Cold\\b","Wind Chill", clean_event)][,clean_event := gsub("\\bCold\\b","Wind Chill", clean_event)][,clean_event := gsub("\\bFreeze\\b","Frost", clean_event)][,clean_event := gsub("\\bTyphoon\\b","Hurricane", clean_event)][,clean_event := gsub("\\bStorm Surge\\b","Tide", clean_event)]
data[,clean_event := as.factor(clean_event)]
levels(data$clean_event)
## [1] "Astronomical Low Tide" "Avalanche"
## [3] "Blizzard" "Coastal Flood"
## [5] "Debris Flow" "Dense Fog"
## [7] "Dense Smoke" "Drought"
## [9] "Dust Devil" "Dust Storm"
## [11] "Excessive Heat" "Flash Flood"
## [13] "Flood" "Freezing Fog"
## [15] "Frost" "Funnel Cloud"
## [17] "Hail" "Hard to categorize"
## [19] "Heat" "Heavy Rain"
## [21] "Heavy Snow" "High Surf"
## [23] "High Wind" "Hurricane"
## [25] "Ice Storm" "Lake-Effect Snow"
## [27] "Lakeshore Flood" "Lightning"
## [29] "Marine Hail" "Marine High Wind"
## [31] "Marine Strong Wind" "Marine Thunderstorm Wind"
## [33] "Rip Current" "Seiche"
## [35] "Sleet" "Strong Wind"
## [37] "Thunderstorm Wind" "Tide"
## [39] "Tornado" "Tropical Depression"
## [41] "Tropical Storm" "Tsunami"
## [43] "Volcanic Ash" "Waterspout"
## [45] "Wildfire" "Wind Chill"
## [47] "Winter Storm" "Winter Weather"
Before keeping only recent years, it is worth noticing that only 0.0085903 percent of all original observations are “Hard to categorize”. As such we are satisfied about the cleaning process that took place (although recognizing that more could be done and would be done if this was a real work analysis). But as mentioned before as data from 1950 to 1954 only have “tornadoes” recorded while 1955 to 1992, only have “hail”, “thunderstorm wind” and “tornadoes”. As such, we only look at 1993 and onward.
## 1950 to 1954, only Tornadoes were recorded.
## 1955 to 1992, only Hail, Thunderstorm Wind and Tornadoes were recorded
## 1993 onward... more categories
data <- data[year >= 1993,]
As mentioned before, for the purpose of this report we use the sum of fatalities and injuries occurring during events to analyse the impact of events with respect to population health. We do not attempt to quantify the value of a fatality compared to an injury, but doing so could result in different outcome. We also do not try to control for population growth impact (e.g. 100 individuals in 1993 does not represent the same proportion of total population in 2011). Controlling for those two caveats but is above the scope of this analysis.
data[,fatalities := FATALITIES]
data[,injuries := INJURIES]
data[, `:=` (total_fatalities = sum(fatalities), total_injuries = sum(injuries)), by = .(clean_event)]
data[, total_human := (total_fatalities + total_injuries)/1000]
We use the sum of property damage and crop damage to quantify events that have the greatest economic consequences. We do not correct any values using inflation to make any year comparable - doing so could result in different results but is above the scope of this analysis.
data[,property_multiplier := ifelse(PROPDMGEXP %in% c("k", "K"),1000,ifelse(PROPDMGEXP %in% c("m", "M"),1000000,ifelse(PROPDMGEXP %in% c("b", "B"),1000000000,1)))]
data[,crop_multiplier := ifelse(CROPDMGEXP %in% c("k", "K"),1000,ifelse(CROPDMGEXP %in% c("m", "M"),1000000,ifelse(CROPDMGEXP %in% c("b", "B"),1000000000,1)))]
data[,property_damage_cost := PROPDMG * property_multiplier]
data[,crop_damage_cost := CROPDMG * crop_multiplier]
data[, `:=` (total_property_damage_cost = sum(property_damage_cost), total_crop_damage_cost = sum(crop_damage_cost)), by = .(clean_event)]
data[, total_cost := (total_property_damage_cost + total_crop_damage_cost)/1000000000]
In order to present only relevant results, the following figures only include storms and other severe weather events within the top 25 percentile in terms of impact. Not doing results in figure hard to read with many irrelevant categories.
summary_data_event <- data[, .SD[1], by = .(clean_event)]
## only keeping top 25 percentile - list is too long if not
human_limit <- quantile(summary_data_event$total_human, c(.001, .01, .05, .1, .2, .3, .5, .75, .99))
cost_limit <- quantile(summary_data_event$total_cost, c(.001, .01, .05, .1, .2, .3, .5, .75, .99))
Focusing on recent years (1993 to 2011), the top 4 events the are most harmful with respect to population health in the United States are 1) tornadoes, 2) excessive heat, 3) flood and 4) thunderstorm wind.
summary_data_event_human <- summary_data_event[total_human > human_limit[8]]
summary_data_event_human <- summary_data_event_human[,.(clean_event, total_human, total_fatalities, total_injuries, total_cost, total_property_damage_cost, total_crop_damage_cost)]
summary_data_event_human <- summary_data_event_human[order(clean_event),]
summary_data_event_human$clean_event = with(summary_data_event_human, reorder(clean_event,total_human))
## Make a barplot of the total human fatalities/injuries by events
g1 <- ggplot(summary_data_event_human, aes(x=clean_event, y=total_human)) + geom_bar(stat="identity") + coord_flip()
g1 <- g1 + labs(title = "Figure 1: Total human fatalities/injuries (000s), 1993 to 2011", subtitle = "(Limited to events with impact above 75th percentile))", y = "Human fatalities/injuries (000s)", x= "Severe weather event") + theme_bw()
g1 <- g1 + theme(plot.title = element_text(size = 10, face = "bold"), plot.subtitle = element_text(size = 8))
g1
Focusing on recent years (1993 to 2011), the top 4 events that have the greatest economic consequences in the United States are 1) flood, 2) hurricane, 3) tide and 4) tornadoes.
summary_data_event_cost <- summary_data_event[total_cost > cost_limit[8]]
summary_data_event_cost <- summary_data_event_cost[,.(clean_event, total_human, total_fatalities, total_injuries, total_cost, total_property_damage_cost, total_crop_damage_cost)]
summary_data_event_cost <- summary_data_event_cost[order(clean_event),]
summary_data_event_cost$clean_event = with(summary_data_event_cost, reorder(clean_event,total_cost))
## Make a barplot of the total property/crop cost by events
g2 <- ggplot(summary_data_event_cost, aes(x=clean_event, y=total_cost)) + geom_bar(stat="identity") + coord_flip()
g2 <- g2 + labs(title = "Figure 2: Estimated property/crop damage cost (B$), 1993 to 2011", subtitle = "(Limited to events with impact above 75th percentile)", y = "Cost (in B$)", x= "Severe weather event") + theme_bw()
g2 <- g2 + theme(plot.title = element_text(size = 10, face = "bold"), plot.subtitle = element_text(size = 8))
g2
While addressing the issues contributing to climate change would help reducing the human and economic impact of those severe events, finding solutions to address the impact of flood (both in the top 4 from a human and economic perspective) might is a good place to start acting now. First step could be to identify zones more susceptible to flooding in municipalities and establish a plan to re localize at risk properties or planning response to appropriately reduce the human and economic impact of floods.