

{"id":12195,"date":"2019-05-18T10:26:34","date_gmt":"2019-05-18T15:26:34","guid":{"rendered":"https:\/\/rud.is\/b\/?p=12195"},"modified":"2019-05-19T11:23:45","modified_gmt":"2019-05-19T16:23:45","slug":"mapping-tornado-alley-with-r","status":"publish","type":"post","link":"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/","title":{"rendered":"Mapping Tornado Alley with R"},"content":{"rendered":"<p>I caught a re-tweet of this tweet by @harry_stevens:<\/p>\n<blockquote class=\"twitter-tweet\">\n<p lang=\"en\" dir=\"ltr\">THREAD: I wrote a post on <a href=\"https:\/\/twitter.com\/observablehq?ref_src=twsrc%5Etfw\">@observablehq<\/a> about a map I made today. It shows a typical day in the life of a graphics journalist: You never know what problems you&#39;ll have to solve on deadline! <a href=\"https:\/\/t.co\/yRhW1wbLxN\">https:\/\/t.co\/yRhW1wbLxN<\/a> <a href=\"https:\/\/twitter.com\/hashtag\/d3js?src=hash&amp;ref_src=twsrc%5Etfw\">#d3js<\/a> <a href=\"https:\/\/twitter.com\/hashtag\/dataviz?src=hash&amp;ref_src=twsrc%5Etfw\">#dataviz<\/a> 1\/7 <a href=\"https:\/\/t.co\/7N6mmK0nz3\">pic.twitter.com\/7N6mmK0nz3<\/a><\/p>\n<p>&mdash; Harry Stevens (@Harry_Stevens) <a href=\"https:\/\/twitter.com\/Harry_Stevens\/status\/1129160171161300995?ref_src=twsrc%5Etfw\">May 16, 2019<\/a><\/p><\/blockquote>\n<p><script async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><\/p>\n<p>Harry&#8217;s thread and Observable post are great on their own and both show the power and utility of Observable javascript notebooks.<\/p>\n<p>However, the re-tweet (which I&#8217;m not posting because it&#8217;s daft) took a swipe at both Python &amp; R. Now, I&#8217;m all for a good swipe at Python (mostly to ensure we never forget all those broken spacebars and tab keys that language has caused) but I&#8217;ll gladly defend it and R together when it comes to Getting Things Done, even on deadline.<\/p>\n<p>Let&#8217;s walk through what one of us might have done had we been in the same scenario as Harry.<\/p>\n<h3>Mapping On A Deadline<\/h3>\n<p>So, we have to create a map of historical tornado frequency trends on deadline.<\/p>\n<p>We emailed researchers and <a href=\"https:\/\/rud.is\/dl\/tornado.zip\">received three <code>txt<\/code> files<\/a>. One is a set of latitudes, another longitudes, and the final one is the trend value. It&#8217;s gridded data.<\/p>\n<p>Download that ZIP and pretend you got three files in email vs a nice ZIP and make a new RStudio project called &#8220;tornado&#8221; and put those three files in a local-to-the-project-root <code>data\/<\/code> directory. Let&#8217;s read them in and look at them:<\/p>\n<pre><code class=\"language-r\">library(hrbrthemes) # not 100% necessary but i like my ggplot2 theme(s) :-)\nlibrary(tidyverse)  # data wrangling &amp; ggplot2\n\ntibble(\n  lat = scan(here::here(\"data\/lats.txt\")),\n  lon = scan(here::here(\"data\/lons.txt\")),\n  trend = scan(here::here(\"data\/trends.txt\"))\n) -&gt; tornado\n<\/code><\/pre>\n<p>You very likely never directly use the <code>base::scan()<\/code> function, but it&#8217;s handy here since we just have files of doubles with each value separated by whitespace. Now, let&#8217;s see what we have:<\/p>\n<pre><code class=\"language-r\">tornado\n## # A tibble: 30,000 x 3\n##      lat   lon trend\n##    &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt;\n##  1 0.897 -180.     0\n##  2 0.897 -179.     0\n##  3 0.897 -178.     0\n##  4 0.897 -176.     0\n##  5 0.897 -175.     0\n##  6 0.897 -174.     0\n##  7 0.897 -173.     0\n##  8 0.897 -172.     0\n##  9 0.897 -170.     0\n## 10 0.897 -169.     0\n## # \u2026 with 29,990 more rows\n\nsummary(tornado)\n##      lat               lon                 trend           \n## Min.   : 0.8973   Min.   :-179.99808   Min.   :-0.4733610  \n## 1st Qu.:22.0063   1st Qu.: -90.00066   1st Qu.: 0.0000000  \n## Median :43.1154   Median :  -0.00323   Median : 0.0000000  \n## Mean   :43.1154   Mean   :  -0.00323   Mean   : 0.0002756  \n## 3rd Qu.:64.2245   3rd Qu.:  89.99419   3rd Qu.: 0.0000000  \n## Max.   :85.3335   Max.   : 179.99161   Max.   : 0.6314569  \n\n#+ grid-overview\nggplot(tornado, aes(lon, lat)) +\n  geom_point(aes(color = trend))\n<\/code><\/pre>\n<p><a href=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-1.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"12196\" data-permalink=\"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/grid-overview-1\/\" data-orig-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-1.png?fit=1920%2C1152&amp;ssl=1\" data-orig-size=\"1920,1152\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"grid-overview-1\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-1.png?fit=300%2C180&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-1.png?fit=510%2C306&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-1.png?resize=510%2C306&#038;ssl=1\" alt=\"\" width=\"510\" height=\"306\" class=\"aligncenter size-large wp-image-12196\" srcset=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-1.png?resize=530%2C318&amp;ssl=1 530w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-1.png?resize=150%2C90&amp;ssl=1 150w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-1.png?resize=300%2C180&amp;ssl=1 300w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-1.png?resize=768%2C461&amp;ssl=1 768w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-1.png?resize=500%2C300&amp;ssl=1 500w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-1.png?resize=1200%2C720&amp;ssl=1 1200w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-1.png?resize=400%2C240&amp;ssl=1 400w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-1.png?resize=800%2C480&amp;ssl=1 800w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-1.png?resize=200%2C120&amp;ssl=1 200w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-1.png?w=1920&amp;ssl=1 1920w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-1.png?w=1020&amp;ssl=1 1020w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-1.png?w=1530&amp;ssl=1 1530w\" sizes=\"auto, (max-width: 510px) 100vw, 510px\" \/><\/a><\/p>\n<pre><code class=\"language-r\">#+ trend-overview\nggplot(tornado, aes(trend)) +\n  geom_histogram() +\n  scale_x_continuous(breaks = seq(-0.5, 0.5, 0.05))\n<\/code><\/pre>\n<p><a href=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/trend-overview-1.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"12198\" data-permalink=\"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/trend-overview-1\/\" data-orig-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/trend-overview-1.png?fit=1920%2C1152&amp;ssl=1\" data-orig-size=\"1920,1152\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"trend-overview-1\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/trend-overview-1.png?fit=300%2C180&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/trend-overview-1.png?fit=510%2C306&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/trend-overview-1.png?resize=510%2C306&#038;ssl=1\" alt=\"\" width=\"510\" height=\"306\" class=\"aligncenter size-large wp-image-12198\" srcset=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/trend-overview-1.png?resize=530%2C318&amp;ssl=1 530w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/trend-overview-1.png?resize=150%2C90&amp;ssl=1 150w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/trend-overview-1.png?resize=300%2C180&amp;ssl=1 300w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/trend-overview-1.png?resize=768%2C461&amp;ssl=1 768w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/trend-overview-1.png?resize=500%2C300&amp;ssl=1 500w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/trend-overview-1.png?resize=1200%2C720&amp;ssl=1 1200w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/trend-overview-1.png?resize=400%2C240&amp;ssl=1 400w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/trend-overview-1.png?resize=800%2C480&amp;ssl=1 800w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/trend-overview-1.png?resize=200%2C120&amp;ssl=1 200w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/trend-overview-1.png?w=1920&amp;ssl=1 1920w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/trend-overview-1.png?w=1020&amp;ssl=1 1020w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/trend-overview-1.png?w=1530&amp;ssl=1 1530w\" sizes=\"auto, (max-width: 510px) 100vw, 510px\" \/><\/a><\/p>\n<p>Since we&#8217;re looking for trends (either direction) in just the <a href=\"https:\/\/www.nature.com\/articles\/s41612-018-0048-2.epdf?author_access_token=PQZthaEqlkut62uLi4HlpNRgN0jAjWel9jnR3ZoTv0Ofpugx93Jq3uh7IKWsjvSCCm9cT6oavbBDxy4CNfmgPbnVGCtRW0GfAXKcI3DSQ1vbeVbyw-jzqriwQAlEDMNsLcaDsYkvTU-SaxpOcafW-Q%3D%3D\">United States<\/a> the latitude and longitude ranges will need to be shrunk down a bit (it does indeed look like globally gridded data) and we&#8217;ll be able to shrink the data set a bit more since we only want to look at large or small tends.<\/p>\n<p>We don&#8217;t really need modern R\/ggplot2 mapping idioms for this project (i.e. the new <code>{sf}<\/code> ecosystem), so we&#8217;ll keep it &#8220;simple&#8221; (scare quotes since that&#8217;s a loaded term) and just use the built in maps and <code>geom_map()<\/code>. First, let&#8217;s get the U.S. states and extract their bounding boxes\/limits:<\/p>\n<pre><code class=\"language-r\">maps::map(\"state\", \".\", exact = FALSE, plot = FALSE, fill = TRUE) %&gt;% \n  fortify(map_obj) %&gt;% \n  as_tibble() -&gt; state_map\n\nxlim &lt;- range(state_map$long)\nylim &lt;- range(state_map$lat)\n<\/code><\/pre>\n<p>NOTE: I tend not to use the handy <code>ggplot::map_data()<\/code> function since it ends up clobbering <code>purrr::map()<\/code> which I use heavily (though not in this post). I also try to use <code>{sf}<\/code> these days so this tends to not be an issue anymore anyway.<\/p>\n<p>Now, let&#8217;s focus in on the target area in the original paper and the Axios article:<\/p>\n<pre><code class=\"language-r\">filter(\n  tornado,\n  between(lon, -107, xlim[2]), between(lat, ylim[1], ylim[2]), # -107 gets us ~left-edge of TX\n  ((trend &lt; -0.07) | (trend &gt; 0.07)) # approximates notebook selection range\n) -&gt; tornado\n\n#+ grid-overview-2\nggplot(tornado, aes(lon, lat)) +\n  geom_point(aes(color = trend))\n<\/code><\/pre>\n<p><a href=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-2-1.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"12199\" data-permalink=\"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/grid-overview-2-1\/\" data-orig-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-2-1.png?fit=1920%2C1152&amp;ssl=1\" data-orig-size=\"1920,1152\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"grid-overview-2-1\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-2-1.png?fit=300%2C180&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-2-1.png?fit=510%2C306&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-2-1.png?resize=510%2C306&#038;ssl=1\" alt=\"\" width=\"510\" height=\"306\" class=\"aligncenter size-large wp-image-12199\" srcset=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-2-1.png?resize=530%2C318&amp;ssl=1 530w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-2-1.png?resize=150%2C90&amp;ssl=1 150w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-2-1.png?resize=300%2C180&amp;ssl=1 300w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-2-1.png?resize=768%2C461&amp;ssl=1 768w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-2-1.png?resize=500%2C300&amp;ssl=1 500w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-2-1.png?resize=1200%2C720&amp;ssl=1 1200w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-2-1.png?resize=400%2C240&amp;ssl=1 400w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-2-1.png?resize=800%2C480&amp;ssl=1 800w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-2-1.png?resize=200%2C120&amp;ssl=1 200w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-2-1.png?w=1920&amp;ssl=1 1920w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-2-1.png?w=1020&amp;ssl=1 1020w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-2-1.png?w=1530&amp;ssl=1 1530w\" sizes=\"auto, (max-width: 510px) 100vw, 510px\" \/><\/a><\/p>\n<p>Now we&#8217;re getting close to our final solution.<\/p>\n<p>As stated in the Observable notebook and implied by the word &#8220;grid&#8221; these dots are centroids of grid rectangles. This means we really want boxes, not points. The article got all fancy but it&#8217;s not really necessary since we can use <code>ggplot2::geom_tile()<\/code> to get us said boxes:<\/p>\n<pre><code class=\"language-r\">#+ grid-overview-3\nggplot(tornado, aes(lon, lat)) +\n  geom_tile(aes(fill = trend, color = trend))\n<\/code><\/pre>\n<p><a href=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-3-1.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"12201\" data-permalink=\"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/grid-overview-3-1\/\" data-orig-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-3-1.png?fit=1920%2C1152&amp;ssl=1\" data-orig-size=\"1920,1152\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"grid-overview-3-1\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-3-1.png?fit=300%2C180&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-3-1.png?fit=510%2C306&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-3-1.png?resize=510%2C306&#038;ssl=1\" alt=\"\" width=\"510\" height=\"306\" class=\"aligncenter size-large wp-image-12201\" srcset=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-3-1.png?resize=530%2C318&amp;ssl=1 530w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-3-1.png?resize=150%2C90&amp;ssl=1 150w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-3-1.png?resize=300%2C180&amp;ssl=1 300w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-3-1.png?resize=768%2C461&amp;ssl=1 768w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-3-1.png?resize=500%2C300&amp;ssl=1 500w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-3-1.png?resize=1200%2C720&amp;ssl=1 1200w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-3-1.png?resize=400%2C240&amp;ssl=1 400w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-3-1.png?resize=800%2C480&amp;ssl=1 800w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-3-1.png?resize=200%2C120&amp;ssl=1 200w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-3-1.png?w=1920&amp;ssl=1 1920w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-3-1.png?w=1020&amp;ssl=1 1020w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/grid-overview-3-1.png?w=1530&amp;ssl=1 1530w\" sizes=\"auto, (max-width: 510px) 100vw, 510px\" \/><\/a><\/p>\n<p>Now, we just need to add in map layers, and tweak some aesthetics to make it look like a map. We&#8217;ll start naively:<\/p>\n<pre><code class=\"language-r\">#+ map-1\nggplot() +\n  geom_tile(\n    data = tornado,\n    aes(lon, lat, fill = trend, color = trend)\n  ) +\n  geom_map(\n    data = state_map, map = state_map,\n    aes(long, lat, map_id = region),\n    color = \"black\", size = 0.125, fill = NA\n  )\n<\/code><\/pre>\n<p><a href=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-1-1.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"12202\" data-permalink=\"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/map-1-1\/\" data-orig-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-1-1.png?fit=1920%2C1152&amp;ssl=1\" data-orig-size=\"1920,1152\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"map-1-1\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-1-1.png?fit=300%2C180&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-1-1.png?fit=510%2C306&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-1-1.png?resize=510%2C306&#038;ssl=1\" alt=\"\" width=\"510\" height=\"306\" class=\"aligncenter size-large wp-image-12202\" srcset=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-1-1.png?resize=530%2C318&amp;ssl=1 530w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-1-1.png?resize=150%2C90&amp;ssl=1 150w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-1-1.png?resize=300%2C180&amp;ssl=1 300w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-1-1.png?resize=768%2C461&amp;ssl=1 768w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-1-1.png?resize=500%2C300&amp;ssl=1 500w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-1-1.png?resize=1200%2C720&amp;ssl=1 1200w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-1-1.png?resize=400%2C240&amp;ssl=1 400w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-1-1.png?resize=800%2C480&amp;ssl=1 800w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-1-1.png?resize=200%2C120&amp;ssl=1 200w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-1-1.png?w=1920&amp;ssl=1 1920w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-1-1.png?w=1020&amp;ssl=1 1020w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-1-1.png?w=1530&amp;ssl=1 1530w\" sizes=\"auto, (max-width: 510px) 100vw, 510px\" \/><\/a><\/p>\n<p>Our gridded data is definitely covering the right\/same areas so we just need to make this more suitable for an article. We&#8217;ll use Harry&#8217;s palette and layer in U.S. state borders, an overall country border, and approximate the title and legend aesthetics:<\/p>\n<pre><code class=\"language-r\">#+ map-final\nc(\n  \"#023858\", \"#045a8d\", \"#0570b0\", \"#3690c0\", \"#74a9cf\",\n  \"#a6bddb\", \"#d0d1e6\", \"#ece7f2\", \"#fff7fb\", \"#ffffff\",\n  \"#ffffcc\", \"#ffeda0\", \"#fed976\", \"#feb24c\", \"#fd8d3c\",\n  \"#fc4e2a\", \"#e31a1c\", \"#bd0026\", \"#800026\"\n) -&gt; grad_cols # colors from article\n\nggplot() +\n\n  # tile layer\n\n  geom_tile(\n    data = tornado,\n    aes(lon, lat, fill = trend, color = trend)\n  ) +\n\n  # state borders\n\n  geom_map(\n    data = state_map, map = state_map,\n    aes(long, lat, map_id = region),\n    color = ft_cols$slate, size = 0.125, fill = NA\n  ) +\n\n  # usa border\n\n  borders(\"usa\", colour = \"black\", size = 0.5) +\n\n  # color scales\n\n  scale_colour_gradientn(\n    colours = grad_cols,\n    labels = c(\"Fewer\", rep(\"\", 4), \"More\"),\n    name = \"Change in tornado frequency, 1979-2017\"\n  ) +\n  scale_fill_gradientn(\n    colours = grad_cols,\n    labels = c(\"Fewer\", rep(\"\", 4), \"More\"),\n    name = \"Change in tornado frequency, 1979-2017\"\n  ) +\n\n  # make it Albers-ish and ensure we can fit the borders in \n\n  coord_map(\n    projection = \"polyconic\",\n    xlim = scales::expand_range(range(tornado$lon), add = 2),\n    ylim = scales::expand_range(range(tornado$lat), add = 2)\n  ) +\n\n  # tweak legend aesthetics\n\n  guides(\n    colour = guide_colourbar(\n      title.position = \"top\", title.hjust = 0.5\n    ),\n    fill = guide_colourbar(\n      title.position = \"top\", title.hjust = 0.5\n    )\n  ) +\n  labs(\n    x = NULL, y = NULL\n  ) +\n  theme_ipsum_rc(grid=\"\") +\n  theme(axis.text = element_blank()) +\n  theme(legend.position = \"top\") +\n  theme(legend.title = element_text(size = 16, hjust = 0.5)) +\n  theme(legend.key.width = unit(4, \"lines\")) +\n  theme(legend.key.height = unit(0.5, \"lines\"))\n<\/code><\/pre>\n<p><a href=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"12207\" data-permalink=\"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/map-final-header\/\" data-orig-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?fit=1001%2C970&amp;ssl=1\" data-orig-size=\"1001,970\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"map-final-header\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?fit=300%2C291&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?fit=510%2C495&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?resize=510%2C494&#038;ssl=1\" alt=\"\" width=\"510\" height=\"494\" class=\"aligncenter size-full wp-image-12207\" srcset=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?w=1001&amp;ssl=1 1001w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?resize=150%2C145&amp;ssl=1 150w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?resize=300%2C291&amp;ssl=1 300w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?resize=768%2C744&amp;ssl=1 768w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?resize=530%2C514&amp;ssl=1 530w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?resize=500%2C485&amp;ssl=1 500w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?resize=400%2C388&amp;ssl=1 400w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?resize=800%2C775&amp;ssl=1 800w, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?resize=200%2C194&amp;ssl=1 200w\" sizes=\"auto, (max-width: 510px) 100vw, 510px\" \/><\/a><\/p>\n<h3>FIN<\/h3>\n<p>I went through some extra steps for folks new to R but the overall approach was at the very least equally as expedient as the Observable one and &#8212; despite the claims by the quite daft retweet &#8212; this is no less &#8220;shareable&#8221; or &#8220;reusable&#8221; than the Observable notebook. You can clone the repo (<a href=\"https:\/\/git.sr.ht\/~hrbrmstr\/tornado\">https:\/\/git.sr.ht\/~hrbrmstr\/tornado<\/a>) and reuse this work immediately.<\/p>\n<p>If you take a stab at an alternate approach &#8212; especially if you do use <code>{sf}<\/code> &#8212; definitely blog about it and drop a link here or on Twitter.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I caught a re-tweet of this tweet by @harry_stevens: THREAD: I wrote a post on @observablehq about a map I made today. It shows a typical day in the life of a graphics journalist: You never know what problems you&#39;ll have to solve on deadline! https:\/\/t.co\/yRhW1wbLxN #d3js #dataviz 1\/7 pic.twitter.com\/7N6mmK0nz3 &mdash; Harry Stevens (@Harry_Stevens) May [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":12207,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[721,753,706,91],"tags":[],"class_list":["post-12195","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cartography","category-ggplot","category-maps","category-r"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Mapping Tornado Alley with R - rud.is<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Mapping Tornado Alley with R - rud.is\" \/>\n<meta property=\"og:description\" content=\"I caught a re-tweet of this tweet by @harry_stevens: THREAD: I wrote a post on @observablehq about a map I made today. It shows a typical day in the life of a graphics journalist: You never know what problems you&#039;ll have to solve on deadline! https:\/\/t.co\/yRhW1wbLxN #d3js #dataviz 1\/7 pic.twitter.com\/7N6mmK0nz3 &mdash; Harry Stevens (@Harry_Stevens) May [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/\" \/>\n<meta property=\"og:site_name\" content=\"rud.is\" \/>\n<meta property=\"article:published_time\" content=\"2019-05-18T15:26:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-05-19T16:23:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?fit=1001%2C970&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"1001\" \/>\n\t<meta property=\"og:image:height\" content=\"970\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"hrbrmstr\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"hrbrmstr\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/\"},\"author\":{\"name\":\"hrbrmstr\",\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\"},\"headline\":\"Mapping Tornado Alley with R\",\"datePublished\":\"2019-05-18T15:26:34+00:00\",\"dateModified\":\"2019-05-19T16:23:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/\"},\"wordCount\":688,\"commentCount\":5,\"publisher\":{\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\"},\"image\":{\"@id\":\"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?fit=1001%2C970&ssl=1\",\"articleSection\":[\"cartography\",\"ggplot\",\"maps\",\"R\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/\",\"url\":\"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/\",\"name\":\"Mapping Tornado Alley with R - rud.is\",\"isPartOf\":{\"@id\":\"https:\/\/rud.is\/b\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?fit=1001%2C970&ssl=1\",\"datePublished\":\"2019-05-18T15:26:34+00:00\",\"dateModified\":\"2019-05-19T16:23:45+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?fit=1001%2C970&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?fit=1001%2C970&ssl=1\",\"width\":1001,\"height\":970},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/rud.is\/b\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Mapping Tornado Alley with R\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/rud.is\/b\/#website\",\"url\":\"https:\/\/rud.is\/b\/\",\"name\":\"rud.is\",\"description\":\"&quot;In God we trust. All others must bring data&quot;\",\"publisher\":{\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/rud.is\/b\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\",\"name\":\"hrbrmstr\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1\",\"url\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1\",\"width\":460,\"height\":460,\"caption\":\"hrbrmstr\"},\"logo\":{\"@id\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1\"},\"description\":\"Don't look at me\u2026I do what he does \u2014 just slower. #rstats avuncular \u2022 ?Resistance Fighter \u2022 Cook \u2022 Christian \u2022 [Master] Chef des Donn\u00e9es de S\u00e9curit\u00e9 @ @rapid7\",\"sameAs\":[\"http:\/\/rud.is\"],\"url\":\"https:\/\/rud.is\/b\/author\/hrbrmstr\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Mapping Tornado Alley with R - rud.is","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/","og_locale":"en_US","og_type":"article","og_title":"Mapping Tornado Alley with R - rud.is","og_description":"I caught a re-tweet of this tweet by @harry_stevens: THREAD: I wrote a post on @observablehq about a map I made today. It shows a typical day in the life of a graphics journalist: You never know what problems you&#39;ll have to solve on deadline! https:\/\/t.co\/yRhW1wbLxN #d3js #dataviz 1\/7 pic.twitter.com\/7N6mmK0nz3 &mdash; Harry Stevens (@Harry_Stevens) May [&hellip;]","og_url":"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/","og_site_name":"rud.is","article_published_time":"2019-05-18T15:26:34+00:00","article_modified_time":"2019-05-19T16:23:45+00:00","og_image":[{"width":1001,"height":970,"url":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?fit=1001%2C970&ssl=1","type":"image\/png"}],"author":"hrbrmstr","twitter_card":"summary_large_image","twitter_misc":{"Written by":"hrbrmstr","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/#article","isPartOf":{"@id":"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/"},"author":{"name":"hrbrmstr","@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"headline":"Mapping Tornado Alley with R","datePublished":"2019-05-18T15:26:34+00:00","dateModified":"2019-05-19T16:23:45+00:00","mainEntityOfPage":{"@id":"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/"},"wordCount":688,"commentCount":5,"publisher":{"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"image":{"@id":"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?fit=1001%2C970&ssl=1","articleSection":["cartography","ggplot","maps","R"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/","url":"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/","name":"Mapping Tornado Alley with R - rud.is","isPartOf":{"@id":"https:\/\/rud.is\/b\/#website"},"primaryImageOfPage":{"@id":"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/#primaryimage"},"image":{"@id":"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?fit=1001%2C970&ssl=1","datePublished":"2019-05-18T15:26:34+00:00","dateModified":"2019-05-19T16:23:45+00:00","breadcrumb":{"@id":"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/#primaryimage","url":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?fit=1001%2C970&ssl=1","contentUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?fit=1001%2C970&ssl=1","width":1001,"height":970},{"@type":"BreadcrumbList","@id":"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/rud.is\/b\/"},{"@type":"ListItem","position":2,"name":"Mapping Tornado Alley with R"}]},{"@type":"WebSite","@id":"https:\/\/rud.is\/b\/#website","url":"https:\/\/rud.is\/b\/","name":"rud.is","description":"&quot;In God we trust. All others must bring data&quot;","publisher":{"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/rud.is\/b\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886","name":"hrbrmstr","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1","url":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1","contentUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1","width":460,"height":460,"caption":"hrbrmstr"},"logo":{"@id":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1"},"description":"Don't look at me\u2026I do what he does \u2014 just slower. #rstats avuncular \u2022 ?Resistance Fighter \u2022 Cook \u2022 Christian \u2022 [Master] Chef des Donn\u00e9es de S\u00e9curit\u00e9 @ @rapid7","sameAs":["http:\/\/rud.is"],"url":"https:\/\/rud.is\/b\/author\/hrbrmstr\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?fit=1001%2C970&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p23idr-3aH","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":14337,"url":"https:\/\/rud.is\/b\/2023\/09\/09\/foliage-2023\/","url_meta":{"origin":12195,"position":0},"title":"Foliage 2023","author":"hrbrmstr","date":"2023-09-09","format":false,"excerpt":"2023-09-10 UPDATE: Art Steinmetz took me up on the Shiny challenge (at the end of the post) and did a fantastic job! The days are getting shorter and when we were visiting Down East Maine the other week, there was just a hint of some trees starting to change up\u2026","rel":"","context":"In &quot;data wrangling&quot;","block_context":{"text":"data wrangling","link":"https:\/\/rud.is\/b\/category\/data-wrangling\/"},"img":{"alt_text":"conus foliage map 2023","src":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/09\/lit-plot.png?fit=1200%2C1137&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/09\/lit-plot.png?fit=1200%2C1137&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/09\/lit-plot.png?fit=1200%2C1137&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/09\/lit-plot.png?fit=1200%2C1137&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/09\/lit-plot.png?fit=1200%2C1137&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":7803,"url":"https:\/\/rud.is\/b\/2018\/01\/15\/cant-stop-at-21-twitter-recipe-22-tying-up-loose-threads\/","url_meta":{"origin":12195,"position":1},"title":"Can&#8217;t Stop at 21: Twitter Recipe #22 \u2014 Tying Up Loose Threads","author":"hrbrmstr","date":"2018-01-15","format":false,"excerpt":"NOTE: The likelihood of this recipe being added to the recent practice bookdown book is slim, but I'll try to keep the same format for the blog post. Problem You want to collect all the tweets in a Twitter tweet thread Solution Use a few key functions in rtweet to\u2026","rel":"","context":"In &quot;R&quot;","block_context":{"text":"R","link":"https:\/\/rud.is\/b\/category\/r\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-15-at-3.01.13-PM.png?fit=962%2C1200&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-15-at-3.01.13-PM.png?fit=962%2C1200&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-15-at-3.01.13-PM.png?fit=962%2C1200&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-15-at-3.01.13-PM.png?fit=962%2C1200&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":13069,"url":"https:\/\/rud.is\/b\/2021\/05\/09\/using-the-new-plot-javascript-exploratory-visualization-library-sans-observable\/","url_meta":{"origin":12195,"position":2},"title":"Using the new Plot Javascript Exploratory Visualization Library Sans-Observable","author":"hrbrmstr","date":"2021-05-09","format":false,"excerpt":"The fine folks over at @ObservableHQ released a new javascript exploratory visualization library called Plot last week with great fanfare. It was primarily designed to be used in Observable notebooks and I quickly tested it out there (you can find them at my Observable landing page: https:\/\/observablehq.com\/@hrbrmstr). {Plot} doesn't require\u2026","rel":"","context":"In &quot;d3&quot;","block_context":{"text":"d3","link":"https:\/\/rud.is\/b\/category\/d3\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":13060,"url":"https:\/\/rud.is\/b\/2021\/05\/06\/covid-19-u-s-county-vaccination-tracker-with-an-observable-notebook-using-datasettes-and-plot\/","url_meta":{"origin":12195,"position":3},"title":"COVID-19 U.S. County Vaccination Tracker With An Observable Notebook Using Datasettes and {Plot}","author":"hrbrmstr","date":"2021-05-06","format":false,"excerpt":"Rather than continue to generate daily images with R, I threw together an Observable notebook that takes advantage of the CDC COVID-19 county data datasette (provided by Simon Willison) and the new {Plot} library (by the @ObservableHQ team) that enables users to interactively see the daily county resident vaccination \"series\u2026","rel":"","context":"In &quot;DataVis&quot;","block_context":{"text":"DataVis","link":"https:\/\/rud.is\/b\/category\/datavis-2\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":14001,"url":"https:\/\/rud.is\/b\/2023\/04\/29\/supreme-annotations-plot-redux-an-ojs-plot%e2%86%94ggplot2-rosetta-stone\/","url_meta":{"origin":12195,"position":4},"title":"Supreme Annotations Plot Redux &#038; An OJS Plot\u2194ggplot2 Rosetta Stone","author":"hrbrmstr","date":"2023-04-29","format":false,"excerpt":"Back in 2016, I did a post on {ggplot2} text annotations because it was a tad more challenging to do some of the things in that post back in the day. Since I've been moving back and forth between R and Observable (and JavaScript in general), I decided to recreate\u2026","rel":"","context":"In &quot;Observable&quot;","block_context":{"text":"Observable","link":"https:\/\/rud.is\/b\/category\/observable\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":13549,"url":"https:\/\/rud.is\/b\/2022\/08\/20\/ohq2quarto-rust-based-cli-for-turning-observable-notebooks-into-quarto-projects\/","url_meta":{"origin":12195,"position":5},"title":"ohq2quarto \u2014 Rust-Based CLI For Turning Observable Notebooks Into Quarto Projects","author":"hrbrmstr","date":"2022-08-20","format":false,"excerpt":"The previous post had some hacky R code to grab seekrit JSON data in ObservableHQ (OHQ) Notebooks and spit out a directory with a Quarto qmd and any associated FileAttachments. Holding firm to my \"no more generic public R packages\" decree, that's as far as the R code for that\u2026","rel":"","context":"In &quot;Quarto&quot;","block_context":{"text":"Quarto","link":"https:\/\/rud.is\/b\/category\/quarto\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/12195","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/comments?post=12195"}],"version-history":[{"count":0,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/12195\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/media\/12207"}],"wp:attachment":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/media?parent=12195"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/categories?post=12195"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/tags?post=12195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}