Last updated: 2019-10-25

Checks: 7 0

Knit directory: wflow-tornadoes/

This reproducible R Markdown analysis was created with workflowr (version 1.4.0.9001). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20191025) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility. The version displayed above was the version of the Git repository at the time these results were generated.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


working directory clean

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the R Markdown and HTML files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view them.

File Version Author Date Message
Rmd ebe2481 Peter Carbonetto 2019-10-26 Quickstart commit from wflow_quickstart()

This is my analysis of tornado data downloaded from the NOAA website.

Load packages

Load the packages used for the analysis.

library(readr)
library(ggplot2)
library(cowplot)

Load tornado data

Load the 2018 storm event data from the CSV file. The output should be a data frame with 62,339 rows and 51 columns.

storms <- read_csv("StormEvents_details-ftp_v1.0_d2018_c20190817.csv.gz")
class(storms) <- "data.frame"
nrow(storms)
ncol(storms)
# [1] 62339
# [1] 51

Here we focus on events classified as tornadoes. There should be 1,250 weather events that are tornadoes.

tornadoes <- subset(storms,EVENT_TYPE == "Tornado")
nrow(tornadoes)
# [1] 1250

The tornadoes are categorized by a severity scale, with “EF3” being the most severe. Only a small number (12) of the tornadoes 2018 were classified as EF3.

tornadoes <- transform(tornadoes,TOR_F_SCALE = factor(TOR_F_SCALE))
summary(tornadoes$TOR_F_SCALE)
# EF0 EF1 EF2 EF3 EFU 
# 681 446  93  12  18

Plot geographic distribution of tornadoes

Using the geographic data provided (the latitudes and longitudes), create a map showing the location of all tornado events that occurred in 2018. Color the tornadoes by severity to highlight the most severe tornadoes (shown in orange and magenta).

rows      <- order(tornadoes$TOR_F_SCALE)
tornadoes <- tornadoes[rows,]
ggplot(tornadoes,aes(x = BEGIN_LON,y = BEGIN_LAT,color = TOR_F_SCALE)) +
  geom_path(data = map_data("state"),aes(x = long,y = lat,group = group),
            color = "black") +
  geom_point(shape = 20,size = 4) +
  scale_color_manual(values = c("lightskyblue","skyblue","darkorange",
                                "magenta","gray")) +
  labs(x = "longitude",y = "latitude")

As expected, the greatest concentration of severe tornadoes is in Midwestern states such as Kansas and Mississippi. There is also a quite large cluster of severe tornadoes in and around upper Louisiana. Indeed, there was a “tornado outbreak” that occurred in Louisiana in April 2018.


sessionInfo()
# R version 3.4.3 (2017-11-30)
# Platform: x86_64-apple-darwin15.6.0 (64-bit)
# Running under: macOS High Sierra 10.13.6
# 
# Matrix products: default
# BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
# LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
# 
# locale:
# [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
# 
# attached base packages:
# [1] stats     graphics  grDevices utils     datasets  methods   base     
# 
# other attached packages:
# [1] cowplot_0.9.4 ggplot2_3.2.0 readr_1.3.1  
# 
# loaded via a namespace (and not attached):
#  [1] Rcpp_1.0.1           pillar_1.3.1         compiler_3.4.3      
#  [4] git2r_0.26.1.9001    plyr_1.8.4           workflowr_1.4.0.9001
#  [7] tools_3.4.3          digest_0.6.18        evaluate_0.13       
# [10] tibble_2.1.1         gtable_0.2.0         pkgconfig_2.0.2     
# [13] rlang_0.3.1          yaml_2.2.0           xfun_0.7            
# [16] withr_2.1.2.9000     stringr_1.4.0        dplyr_0.8.0.1       
# [19] knitr_1.23           fs_1.2.7             hms_0.4.2           
# [22] maps_3.3.0           rprojroot_1.3-2      grid_3.4.3          
# [25] tidyselect_0.2.5     glue_1.3.1           R6_2.4.0            
# [28] rmarkdown_1.16       purrr_0.2.5          magrittr_1.5        
# [31] whisker_0.3-2        backports_1.1.2      scales_0.5.0        
# [34] htmltools_0.3.6      assertthat_0.2.1     colorspace_1.4-0    
# [37] labeling_0.3         stringi_1.4.3        lazyeval_0.2.1      
# [40] munsell_0.4.3        crayon_1.3.4