

{"id":5565,"date":"2017-04-01T12:34:04","date_gmt":"2017-04-01T17:34:04","guid":{"rendered":"https:\/\/rud.is\/b\/?p=5565"},"modified":"2018-10-28T10:51:39","modified_gmt":"2018-10-28T15:51:39","slug":"r%e2%81%b4-snow-day-facets","status":"publish","type":"post","link":"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/","title":{"rendered":"R\u2076 \u2014 Snow Day Facets"},"content":{"rendered":"<p>Back in 2014 I blogged about <a href=\"https:\/\/rud.is\/b\/2014\/11\/26\/visualizing-historical-most-likely-first-snowfall-dates-for-u-s-regions\/\">first snowfall dates<\/a> for a given U.S. state. It&#8217;s April 1, 2017 and we&#8217;re slated to get 12-18&#8243; of snow up here in Maine and @mrshrbrmstr asked how often this \u2014\u00a0snow in May \u2014 has occurred near us.<\/p>\n<p>As with all of these &#8220;R\u2076 posts, expository is minimal and the focus is generally to demonstrate one small concept.<\/p>\n<p>What I&#8217;ve done here (first) is make a full <code>tidyverse<\/code> update to the <a href=\"https:\/\/github.com\/hrbrmstr\/snowfirst\"><code>snowfirst<\/code><\/a> code posted in the aforementioned blog post. You&#8217;ll need to clone that repo if you&#8217;re trying to work verbatim from the code below (otherwise just change file path code):<\/p>\n<pre id=\"snow-when-01\"><code class=\"language-r\">library(rprojroot)\r\nlibrary(stringi)\r\nlibrary(hrbrthemes)\r\nlibrary(tidyverse)\r\n\r\npre &lt;- find_rstudio_root_file()\r\n\r\n# Get and read in Maine precip ------------------------------------------------------\r\n\r\nURL &lt;- &quot;http:\/\/cdiac.ornl.gov\/ftp\/ushcn_daily\/state17_ME.txt.gz&quot;\r\nfil &lt;- file.path(pre, &quot;data&quot;, basename(URL))\r\nif (!file.exists(fil)) download.file(URL, fil)\r\n\r\nread_fwf(file = fil,\r\n         col_positions = fwf_widths(c(6, 4, 2, 4, rep(c(5, 1, 1, 1), 31)),\r\n                                    col_names = c(&quot;coop_id&quot;, &quot;year&quot;, &quot;month&quot;, &quot;element&quot;,\r\n                                                  flatten_chr(map(1:31, ~paste(&quot;r_&quot;, c(&quot;v&quot;, &quot;fm&quot;, &quot;fq&quot;, &quot;fs&quot;),\r\n                                                                               .x, sep=&quot;&quot;))))),\r\n         col_types = paste0(&quot;ciic&quot;, paste0(rep(&quot;iccc&quot;, 31), collapse=&quot;&quot;), collapse=&quot;&quot;),\r\n         na = c(&quot;&quot;, &quot;NA&quot;, &quot;-&quot;, &quot;-9999&quot;)) %&gt;%\r\n  gather(day, value, starts_with(&quot;r_v&quot;)) %&gt;%\r\n  select(-starts_with(&quot;r_&quot;)) %&gt;%\r\n  mutate(day = as.numeric(stri_replace_first_fixed(day, &quot;r_v&quot;, &quot;&quot;))) %&gt;%\r\n  mutate(date = sprintf(&quot;%s-%02d-%02d&quot;, year, month, day)) -&gt; daily_wx\r\n\r\n# Read in stations ------------------------------------------------------------------\r\n\r\nURL &lt;- &quot;http:\/\/cdiac.ornl.gov\/ftp\/ushcn_daily\/ushcn-stations.txt&quot;\r\nfil &lt;- file.path(pre, &quot;data&quot;, basename(URL))\r\nif (!file.exists(fil)) download.file(URL, fil)\r\n\r\nread_fwf(file = file.path(pre, &quot;data&quot;, &quot;ushcn-stations.txt&quot;),\r\n         col_positions = fwf_widths(c(6, 9, 10, 7, 3, 31, 7, 7, 7, 3),\r\n                                    col_names = c(&quot;coop_id&quot;, &quot;latitude&quot;, &quot;longitude&quot;,\r\n                                                  &quot;elevation&quot;, &quot;state&quot;, &quot;name&quot;,\r\n                                                  &quot;component_1&quot;, &quot;component_2&quot;,\r\n                                                  &quot;component_3&quot;, &quot;utc_offset&quot;)),\r\n         col_types = &quot;cdddcccccc&quot;) -&gt; stations\r\n\r\nclosestStation &lt;- function(stations, lat, lon, restrict_to = NULL) {\r\n  if (!is.null(restrict_to)) stations &lt;- filter(stations, state == restrict_to)\r\n  index &lt;- which.min(sqrt((stations$latitude-lat)^2 +\r\n                            (stations$longitude-lon)^2))\r\n  stations[index,]\r\n}\r\n\r\n# compute total snow amounts per month ----------------------------------------------\r\n\r\n(near_me &lt;- closestStation(stations, 43.2672, -70.8617, restrict_to=&quot;ME&quot;))<\/code><\/pre>\n<p>Now that we have the data, the short lesson here is just exposing the fact that you can get blank facets for free with ggplot2. I&#8217;m pointing this out as many folks seem to not like reading R documentation or miss things in said documentation (in fact, I had to be instructed today by @thomasp85 about a <code>ggplot2<\/code> theme element setting that I didn&#8217;t know about and <em>should have<\/em> since I do try to keep up).<\/p>\n<pre id=\"snow-when-02\"><code class=\"language-r\">filter(daily_wx, coop_id == near_me$coop_id, element==&quot;SNOW&quot;, value&gt;0) %&gt;%\r\n  count(year, month, wt=value) %&gt;%\r\n  ungroup() %&gt;%\r\n  mutate(\r\n    n = n \/ 10, # readings are in 10ths of inches\r\n    date = as.Date(sprintf(&quot;%s-%02d-01&quot;, year, month)),\r\n    month_name = lubridate::month(date, TRUE, FALSE)\r\n  ) %&gt;%\r\n  ggplot(aes(x=date, y=n)) +\r\n  geom_segment(aes(xend=date, yend=0), size=0.75, color=&quot;#9ecae1&quot;) +\r\n  scale_y_continuous(limits=c(0, 65)) +\r\n  facet_wrap(~month_name, ncol=3, drop=FALSE, scales=&quot;free&quot;) +\r\n  labs(x=NULL, y=&quot;inches&quot;, title=&quot;Total snowfall in a given month by year&quot;,\r\n       subtitle=&quot;Data for Station id 176905 \u2014 Portland (Maine) Jetport&quot;) +\r\n  theme_ipsum_rc(grid=&quot;Y&quot;, axis_text_size=8)<\/code><\/pre>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5566\" data-permalink=\"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/cursor_and___projects_snowfirst_-_master_-_rstudio\/\" data-orig-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/04\/Cursor_and___projects_snowfirst_-_master_-_RStudio.png?fit=1744%2C1596&amp;ssl=1\" data-orig-size=\"1744,1596\" 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=\"Cursor_and___projects_snowfirst_-_master_-_RStudio\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/04\/Cursor_and___projects_snowfirst_-_master_-_RStudio.png?fit=300%2C275&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/04\/Cursor_and___projects_snowfirst_-_master_-_RStudio.png?fit=510%2C467&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/04\/Cursor_and___projects_snowfirst_-_master_-_RStudio.png?resize=510%2C467&#038;ssl=1\" alt=\"\" width=\"510\" height=\"467\" class=\"aligncenter size-full wp-image-5566\" \/><\/p>\n<p>Without <code>ggplot2<\/code> helping us out we would have had to do some work to have those no-value facets to show up. I also like how there are no x-axis labels since there&#8217;s no data. <code>ggplot2::facet_wrap()<\/code> has many, very granular options for customizing the appearance of facets:<\/p>\n<pre id=\"snow-when-04\"><code class=\"language-r\">facet_wrap(facets, nrow = NULL, ncol = NULL, scales = &quot;fixed&quot;,\r\n           shrink = TRUE, labeller = &quot;label_value&quot;, as.table = TRUE,\r\n           switch = NULL, drop = TRUE, dir = &quot;h&quot;, strip.position = &quot;top&quot;)<\/code><\/pre>\n<p>If you haven&#8217;t played with them, you can use this example to try them out.<\/p>\n<h3>Fin<\/h3>\n<p>Even though that visualization gets the message across, I kinda like this view a bit better:<\/p>\n<pre id=\"snow-when-03\"><code class=\"language-r\">filter(daily_wx, coop_id == near_me$coop_id, element==&quot;SNOW&quot;, value&gt;0) %&gt;%\r\n  count(year, month, wt=value) %&gt;%\r\n  ungroup() %&gt;%\r\n  mutate(n = n \/ 10) %&gt;%\r\n  complete(year, month=1:12) %&gt;%\r\n  mutate(\r\n    date = as.Date(sprintf(&quot;%s-%02d-01&quot;, year, month)),\r\n    month_name = factor(lubridate::month(date, TRUE, FALSE), levels=rev(month.name))\r\n  ) %&gt;% \r\n  ggplot(aes(year, month_name)) +\r\n  geom_tile(aes(fill=n), color=&quot;#b2b2b2&quot;, size=0.15) +\r\n  scale_x_continuous(expand=c(0,0.15), position=&quot;top&quot;) +\r\n  viridis::scale_fill_viridis(name = &quot;Total inches&quot;, na.value=&quot;white&quot;) +\r\n  labs(x=NULL, y=NULL, title=&quot;Total snowfall in a given month by year&quot;,\r\n       subtitle=&quot;Data for Station id 176905 \u2014 Portland (Maine) Jetport&quot;) +\r\n  theme_ipsum_rc(grid=&quot;&quot;, axis_text_size = 10) +\r\n  guides(fill=guide_colourbar(label.position = &quot;top&quot;, direction = &quot;horizontal&quot;, title.vjust = 0)) +\r\n  theme(legend.title = element_text(size=10)) +\r\n  theme(legend.key.height = unit(0.5, &quot;lines&quot;)) +\r\n  theme(legend.position = c(0.9, 1.25))<\/code><\/pre>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5568\" data-permalink=\"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/cursor_and___projects_snowfirst_-_master_-_rstudio-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/04\/Cursor_and___projects_snowfirst_-_master_-_RStudio-1.png?fit=2114%2C578&amp;ssl=1\" data-orig-size=\"2114,578\" 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=\"Cursor_and___projects_snowfirst_-_master_-_RStudio\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/04\/Cursor_and___projects_snowfirst_-_master_-_RStudio-1.png?fit=300%2C82&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/04\/Cursor_and___projects_snowfirst_-_master_-_RStudio-1.png?fit=510%2C139&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/04\/Cursor_and___projects_snowfirst_-_master_-_RStudio-1.png?resize=510%2C139&#038;ssl=1\" alt=\"\" width=\"510\" height=\"139\" class=\"aligncenter size-full wp-image-5568\" \/><\/p>\n<p>The precision is lacking in the heatmap view, but you get a quick impression of when it has\/hasn&#8217;t snowed. Plus you get to use <code>viridis<\/code> ?<\/p>\n<p>All the updated code in in the <a href=\"https:\/\/github.com\/hrbrmstr\/snowfirst\"><code>snowfirst<\/code> repo<\/a>.<\/p>\n<p>Crank you your own, small code snippets or ideas to the R community. R\u2076 is an open tag and perhaps we can band together to make a distributed cadre of helpful, digestible posts the R community can benefit from.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Back in 2014 I blogged about first snowfall dates for a given U.S. state. It&#8217;s April 1, 2017 and we&#8217;re slated to get 12-18&#8243; of snow up here in Maine and @mrshrbrmstr asked how often this \u2014\u00a0snow in May \u2014 has occurred near us. As with all of these &#8220;R\u2076 posts, expository is minimal and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5566,"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":true,"_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":[753,91],"tags":[810,787],"class_list":["post-5565","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ggplot","category-r","tag-post","tag-r6"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>R\u2076 \u2014 Snow Day Facets - 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\/2017\/04\/01\/r\u2074-snow-day-facets\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"R\u2076 \u2014 Snow Day Facets - rud.is\" \/>\n<meta property=\"og:description\" content=\"Back in 2014 I blogged about first snowfall dates for a given U.S. state. It&#8217;s April 1, 2017 and we&#8217;re slated to get 12-18&#8243; of snow up here in Maine and @mrshrbrmstr asked how often this \u2014\u00a0snow in May \u2014 has occurred near us. As with all of these &#8220;R\u2076 posts, expository is minimal and [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/rud.is\/b\/2017\/04\/01\/r\u2074-snow-day-facets\/\" \/>\n<meta property=\"og:site_name\" content=\"rud.is\" \/>\n<meta property=\"article:published_time\" content=\"2017-04-01T17:34:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-10-28T15:51:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/04\/Cursor_and___projects_snowfirst_-_master_-_RStudio.png?fit=1744%2C1596&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"1744\" \/>\n\t<meta property=\"og:image:height\" content=\"1596\" \/>\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=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/\"},\"author\":{\"name\":\"hrbrmstr\",\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\"},\"headline\":\"R\u2076 \u2014 Snow Day Facets\",\"datePublished\":\"2017-04-01T17:34:04+00:00\",\"dateModified\":\"2018-10-28T15:51:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/\"},\"wordCount\":359,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\"},\"image\":{\"@id\":\"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/04\/Cursor_and___projects_snowfirst_-_master_-_RStudio.png?fit=1744%2C1596&ssl=1\",\"keywords\":[\"post\",\"r6\"],\"articleSection\":[\"ggplot\",\"R\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/\",\"url\":\"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/\",\"name\":\"R\u2076 \u2014 Snow Day Facets - rud.is\",\"isPartOf\":{\"@id\":\"https:\/\/rud.is\/b\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/04\/Cursor_and___projects_snowfirst_-_master_-_RStudio.png?fit=1744%2C1596&ssl=1\",\"datePublished\":\"2017-04-01T17:34:04+00:00\",\"dateModified\":\"2018-10-28T15:51:39+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/04\/Cursor_and___projects_snowfirst_-_master_-_RStudio.png?fit=1744%2C1596&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/04\/Cursor_and___projects_snowfirst_-_master_-_RStudio.png?fit=1744%2C1596&ssl=1\",\"width\":1744,\"height\":1596},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/rud.is\/b\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"R\u2076 \u2014 Snow Day Facets\"}]},{\"@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":"R\u2076 \u2014 Snow Day Facets - 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\/2017\/04\/01\/r\u2074-snow-day-facets\/","og_locale":"en_US","og_type":"article","og_title":"R\u2076 \u2014 Snow Day Facets - rud.is","og_description":"Back in 2014 I blogged about first snowfall dates for a given U.S. state. It&#8217;s April 1, 2017 and we&#8217;re slated to get 12-18&#8243; of snow up here in Maine and @mrshrbrmstr asked how often this \u2014\u00a0snow in May \u2014 has occurred near us. As with all of these &#8220;R\u2076 posts, expository is minimal and [&hellip;]","og_url":"https:\/\/rud.is\/b\/2017\/04\/01\/r\u2074-snow-day-facets\/","og_site_name":"rud.is","article_published_time":"2017-04-01T17:34:04+00:00","article_modified_time":"2018-10-28T15:51:39+00:00","og_image":[{"width":1744,"height":1596,"url":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/04\/Cursor_and___projects_snowfirst_-_master_-_RStudio.png?fit=1744%2C1596&ssl=1","type":"image\/png"}],"author":"hrbrmstr","twitter_card":"summary_large_image","twitter_misc":{"Written by":"hrbrmstr","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/#article","isPartOf":{"@id":"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/"},"author":{"name":"hrbrmstr","@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"headline":"R\u2076 \u2014 Snow Day Facets","datePublished":"2017-04-01T17:34:04+00:00","dateModified":"2018-10-28T15:51:39+00:00","mainEntityOfPage":{"@id":"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/"},"wordCount":359,"commentCount":1,"publisher":{"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"image":{"@id":"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/04\/Cursor_and___projects_snowfirst_-_master_-_RStudio.png?fit=1744%2C1596&ssl=1","keywords":["post","r6"],"articleSection":["ggplot","R"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/","url":"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/","name":"R\u2076 \u2014 Snow Day Facets - rud.is","isPartOf":{"@id":"https:\/\/rud.is\/b\/#website"},"primaryImageOfPage":{"@id":"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/#primaryimage"},"image":{"@id":"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/04\/Cursor_and___projects_snowfirst_-_master_-_RStudio.png?fit=1744%2C1596&ssl=1","datePublished":"2017-04-01T17:34:04+00:00","dateModified":"2018-10-28T15:51:39+00:00","breadcrumb":{"@id":"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/#primaryimage","url":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/04\/Cursor_and___projects_snowfirst_-_master_-_RStudio.png?fit=1744%2C1596&ssl=1","contentUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/04\/Cursor_and___projects_snowfirst_-_master_-_RStudio.png?fit=1744%2C1596&ssl=1","width":1744,"height":1596},{"@type":"BreadcrumbList","@id":"https:\/\/rud.is\/b\/2017\/04\/01\/r%e2%81%b4-snow-day-facets\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/rud.is\/b\/"},{"@type":"ListItem","position":2,"name":"R\u2076 \u2014 Snow Day Facets"}]},{"@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\/2017\/04\/Cursor_and___projects_snowfirst_-_master_-_RStudio.png?fit=1744%2C1596&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p23idr-1rL","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":4501,"url":"https:\/\/rud.is\/b\/2016\/07\/07\/bridging-the-political-polygons-gap-with-ggplot2\/","url_meta":{"origin":5565,"position":0},"title":"Bridging The Political [Polygons] Gap with ggplot2","author":"hrbrmstr","date":"2016-07-07","format":false,"excerpt":"The @pewresearch folks have been collecting political survey data for quite a while, and I noticed the [visualization below](http:\/\/www.people-press.org\/2014\/06\/12\/section-1-growing-ideological-consistency\/#interactive) referenced in a [Tableau vis contest entry](https:\/\/www.interworks.com\/blog\/rrouse\/2016\/06\/24\/politics-viz-contest-plotting-political-polarization): Those are filled [frequency polygons](http:\/\/onlinestatbook.com\/2\/graphing_distributions\/freq_poly.html), which are super-easy to replicate in ggplot2, especially since Pew even _kind of_ made the data available via their\u2026","rel":"","context":"In &quot;Data Visualization&quot;","block_context":{"text":"Data Visualization","link":"https:\/\/rud.is\/b\/category\/data-visualization\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/07\/engfull.png?fit=1200%2C1098&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/07\/engfull.png?fit=1200%2C1098&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/07\/engfull.png?fit=1200%2C1098&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/07\/engfull.png?fit=1200%2C1098&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/07\/engfull.png?fit=1200%2C1098&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":4396,"url":"https:\/\/rud.is\/b\/2016\/05\/14\/global-temperature-change-in-r-d3-without-the-vertigo\/","url_meta":{"origin":5565,"position":1},"title":"Global Temperature Change in R &#038; D3 (without the vertigo)","author":"hrbrmstr","date":"2016-05-14","format":false,"excerpt":"This made the rounds on social media last week: Spiraling global temperatures from 1850-2016 (full animation) https:\/\/t.co\/YETC5HkmTr pic.twitter.com\/Ypci717AHq\u2014 Ed Hawkins (@ed_hawkins) May 9, 2016 One of the original versions was static and was not nearly as popular, but\u2014as you can see\u2014this one went viral. Despite the public's infatuation with circles\u2026","rel":"","context":"In &quot;Charts &amp; Graphs&quot;","block_context":{"text":"Charts &amp; Graphs","link":"https:\/\/rud.is\/b\/category\/charts-graphs\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/05\/hadcrut.png?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/05\/hadcrut.png?fit=1200%2C600&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/05\/hadcrut.png?fit=1200%2C600&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/05\/hadcrut.png?fit=1200%2C600&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/05\/hadcrut.png?fit=1200%2C600&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3127,"url":"https:\/\/rud.is\/b\/2014\/11\/26\/visualizing-historical-most-likely-first-snowfall-dates-for-u-s-regions\/","url_meta":{"origin":5565,"position":2},"title":"Visualizing Historical &#038; Most-likely First Snowfall Dates for U.S. Regions","author":"hrbrmstr","date":"2014-11-26","format":false,"excerpt":"UPDATE: You can now run this as a local Shiny app by entering shiny::runGist(\"95ec24c1b0cb433a76a5\", launch.browser=TRUE) at an R prompt (provided all the dependent libraries (below) are installed) or use it interactively over at Shiny Apps. The impending arrival of the first real snowfall of the year in my part of\u2026","rel":"","context":"In &quot;Charts &amp; Graphs&quot;","block_context":{"text":"Charts &amp; Graphs","link":"https:\/\/rud.is\/b\/category\/charts-graphs\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3977,"url":"https:\/\/rud.is\/b\/2016\/02\/27\/create-vega-lite-specs-widgets-with-the-vegalite-package\/","url_meta":{"origin":5565,"position":3},"title":"Create Vega-Lite specs &#038; widgets with the vegalite package","author":"hrbrmstr","date":"2016-02-27","format":false,"excerpt":"[Vega-Lite](http:\/\/vega.github.io\/vega-lite\/) 1.0 was [released this past week](https:\/\/medium.com\/@uwdata\/introducing-vega-lite-438f9215f09e#.yfkl0tp1c). I had been meaning to play with it for a while but I've been burned before by working with unstable APIs and was waiting for this to bake to a stable release. Thankfully, there were no new shows in the Fire TV, Apple\u2026","rel":"","context":"In &quot;d3&quot;","block_context":{"text":"d3","link":"https:\/\/rud.is\/b\/category\/d3\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/02\/gallery.png?fit=1200%2C595&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/02\/gallery.png?fit=1200%2C595&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/02\/gallery.png?fit=1200%2C595&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/02\/gallery.png?fit=1200%2C595&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/02\/gallery.png?fit=1200%2C595&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3796,"url":"https:\/\/rud.is\/b\/2015\/11\/21\/an-os-x-r-task-runner-for-and-a-mini-r-centric-review-of-microsofts-visual-studio-code-editor\/","url_meta":{"origin":5565,"position":4},"title":"An OS X R Task Runner for\u2014and a Mini-R-centric review of\u2014Microsoft&#8217;s Visual Studio Code Editor","author":"hrbrmstr","date":"2015-11-21","format":false,"excerpt":"Microsoft's newfound desire to make themselves desirable to the hipster development community has caused them to make many things [open](https:\/\/github.com\/Microsoft\/) and\/or free of late. One of these manifestations is [Visual Studio Code](https:\/\/code.visualstudio.com\/), an [Atom](https:\/\/atom.io\/)-ish editor for us code jockeys. I have friends at Microsoft and the Revolution R folks are\u2026","rel":"","context":"In &quot;Development&quot;","block_context":{"text":"Development","link":"https:\/\/rud.is\/b\/category\/development\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1750,"url":"https:\/\/rud.is\/b\/2012\/10\/28\/watch-sandy-in-r-including-forecast-cone\/","url_meta":{"origin":5565,"position":5},"title":"Watch Sandy in &#8220;R&#8221; (Including Forecast Cone)","author":"hrbrmstr","date":"2012-10-28","format":false,"excerpt":"As indicated in the code comments, Google took down the cone KML files. I'll be changing the code to use the NHC archived cone files later tonight NOTE: There is significantly updated code on github for the Sandy 'R' dataviz. This is a follow-up post to the quickly crafted Watch\u2026","rel":"","context":"In &quot;R&quot;","block_context":{"text":"R","link":"https:\/\/rud.is\/b\/category\/r\/"},"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\/5565","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=5565"}],"version-history":[{"count":0,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/5565\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/media\/5566"}],"wp:attachment":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/media?parent=5565"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/categories?post=5565"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/tags?post=5565"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}