

{"id":5178,"date":"2017-03-19T12:57:46","date_gmt":"2017-03-19T17:57:46","guid":{"rendered":"https:\/\/rud.is\/b\/?p=5178"},"modified":"2018-03-07T17:21:48","modified_gmt":"2018-03-07T22:21:48","slug":"exploring-2017-retail-store-closings-with-r","status":"publish","type":"post","link":"https:\/\/rud.is\/b\/2017\/03\/19\/exploring-2017-retail-store-closings-with-r\/","title":{"rendered":"Exploring 2017 Retail Store Closings with R"},"content":{"rendered":"<p>A story about one of the retail chains (J.C. Penny) releasing their list of stores closing in 2017 <a href=\"https:\/\/www.yahoo.com\/news\/jc-penney-releases-full-list-103403009.html\">crossed paths<\/a> with my Feedly reading list today and jogged my memory that there were a number of chains closing many of their doors this year, and I wanted to see the impact that might have on various states.<\/p>\n<p>I&#8217;m also doing this to add one more example of:<\/p>\n<ul>\n<li>scraping (with content caching)<\/li>\n<li>data cleaning<\/li>\n<li>per-capita normalization<\/li>\n<li>comparing salient information to other indicators<\/li>\n<\/ul>\n<p>to the growing list of great examples out there by the extended R community. Plus, I feel compelled to try to keep up with @ma_salmon&#8217;s <a href=\"http:\/\/www.masalmon.eu\/\">blogging pace<\/a>.<\/p>\n<p>Let&#8217;s jump right in\u2026<\/p>\n<pre id=\"closings-01\"><code class=\"language-r\">library(httr)\r\nlibrary(rvest)\r\nlibrary(knitr)\r\nlibrary(kableExtra)\r\nlibrary(ggalt)\r\nlibrary(statebins)\r\nlibrary(hrbrthemes)\r\nlibrary(tidyverse)\r\n\r\noptions(knitr.table.format = &quot;html&quot;)\r\nupdate_geom_font_defaults(font_rc_light, size = 2.75)<\/code><\/pre>\n<p>&#8220;Closing&#8221; lists of four major retailers \u2014 K-Mart, Sears, Macy&#8217;s and J.C. Penny \u2014 abound (HTML formatting a list seems to be the &#8220;easy way out&#8221; story-wise for many blogs and newspapers). We can dig a bit deeper than just a plain set of lists, but first we need the data.<\/p>\n<p>The Boston Globe has a nice, predictable, mostly-uniform pattern to their list-closing &#8220;stories&#8221;, so we&#8217;ll use that data. Site content can change quickly, so it makes sense to try to cache content whenever possible as we scrape it. To that end, we&#8217;ll use <code>httr::GET<\/code> vs <code>xml2::read_html<\/code> since <code>GET<\/code> preserves all of the original request and response information and <code>read_html<\/code> returns an external pointer that has no current support for serialization without extra work.<\/p>\n<pre id=\"closings-02\"><code class=\"language-r\">closings &lt;- list(\r\n  kmart = &quot;https:\/\/www.bostonglobe.com\/metro\/2017\/01\/05\/the-full-list-kmart-stores-closing-around\/4kJ0YVofUWHy5QJXuPBAuM\/story.html&quot;,\r\n  sears = &quot;https:\/\/www.bostonglobe.com\/metro\/2017\/01\/05\/the-full-list-sears-stores-closing-around\/yHaP6nV2C4gYw7KLhuWuFN\/story.html&quot;,\r\n  macys = &quot;https:\/\/www.bostonglobe.com\/metro\/2017\/01\/05\/the-full-list-macy-stores-closing-around\/6TY8a3vy7yneKV1nYcwY7K\/story.html&quot;,\r\n    jcp = &quot;https:\/\/www.bostonglobe.com\/business\/2017\/03\/17\/the-full-list-penney-stores-closing-around\/vhoHjI3k75k2pSuQt2mZpO\/story.html&quot;\r\n)\r\n\r\nsaved_pgs &lt;- &quot;saved_store_urls.rds&quot;\r\n\r\nif (file.exists(saved_pgs)) {\r\n  pgs &lt;- read_rds(saved_pgs)\r\n} else {\r\n  pgs &lt;- map(closings, GET)\r\n  write_rds(pgs, saved_pgs)\r\n}<\/code><\/pre>\n<p>This is what we get from that scraping effort:<\/p>\n<pre id=\"closings-03\"><code class=\"language-r\">map(pgs, content) %&gt;%\r\n  map(html_table) %&gt;%\r\n  walk(~glimpse(.[[1]]))\r\n## Observations: 108\r\n## Variables: 3\r\n## $ X1 &lt;chr&gt; &quot;300 Highway 78 E&quot;, &quot;2003 US Hwy 280 Bypass&quot;, &quot;3600 Wilson ...\r\n## $ X2 &lt;chr&gt; &quot;Jasper&quot;, &quot;Phenix City&quot;, &quot;Bakersfield&quot;, &quot;Coalinga&quot;, &quot;Kingsb...\r\n## $ X3 &lt;chr&gt; &quot;AL&quot;, &quot;AL&quot;, &quot;CA&quot;, &quot;CA&quot;, &quot;CA&quot;, &quot;CA&quot;, &quot;CO&quot;, &quot;CO&quot;, &quot;CT&quot;, &quot;FL&quot;,...\r\n## Observations: 42\r\n## Variables: 4\r\n## $ X1 &lt;chr&gt; &quot;301 Cox Creek Pkwy&quot;, &quot;1901 S Caraway Road&quot;, &quot;90 Elm St; En...\r\n## $ X2 &lt;chr&gt; &quot;Florence&quot;, &quot;Jonesboro&quot;, &quot;Enfield&quot;, &quot;Lake Wales&quot;, &quot;Albany&quot;,...\r\n## $ X3 &lt;chr&gt; &quot;AL&quot;, &quot;AR&quot;, &quot;CT&quot;, &quot;FL&quot;, &quot;GA&quot;, &quot;GA&quot;, &quot;IN&quot;, &quot;KS&quot;, &quot;KY&quot;, &quot;LA&quot;,...\r\n## $ X4 &lt;chr&gt; &quot;Y&quot;, &quot;N&quot;, &quot;N&quot;, &quot;Y&quot;, &quot;Y&quot;, &quot;N&quot;, &quot;N&quot;, &quot;N&quot;, &quot;Y&quot;, &quot;Y&quot;, &quot;Y&quot;, &quot;Y&quot;,...\r\n## Observations: 68\r\n## Variables: 6\r\n## $ X1 &lt;chr&gt; &quot;Mission Valley Apparel&quot;, &quot;Paseo\u00a0Nuevo&quot;, &quot;*Laurel Plaza&quot;, &quot;...\r\n## $ X2 &lt;chr&gt; &quot;San Diego&quot;, &quot;Santa Barbara&quot;, &quot;North Hollywood&quot;, &quot;Simi Vall...\r\n## $ X3 &lt;chr&gt; &quot;CA&quot;, &quot;CA&quot;, &quot;CA&quot;, &quot;CA&quot;, &quot;FL&quot;, &quot;FL&quot;, &quot;FL&quot;, &quot;FL&quot;, &quot;FL&quot;, &quot;GA&quot;,...\r\n## $ X4 &lt;int&gt; 385000, 141000, 475000, 190000, 101000, 195000, 143000, 140...\r\n## $ X5 &lt;int&gt; 1961, 1990, 1995, 2006, 1995, 2000, 1977, 1974, 2000, 1981,...\r\n## $ X6 &lt;int&gt; 140, 77, 105, 105, 68, 83, 86, 73, 72, 69, 9, 57, 54, 87, 5...\r\n## Observations: 138\r\n## Variables: 3\r\n## $ Mall\/Shopping Center &lt;chr&gt; &quot;Auburn Mall&quot;, &quot;Tannehill Promenade&quot;, &quot;Ga...\r\n## $ City                 &lt;chr&gt; &quot;Auburn&quot;, &quot;Bessemer&quot;, &quot;Gadsden&quot;, &quot;Jasper&quot;...\r\n## $ State                &lt;chr&gt; &quot;AL&quot;, &quot;AL&quot;, &quot;AL&quot;, &quot;AL&quot;, &quot;AR&quot;, &quot;AR&quot;, &quot;AZ&quot;,...<\/code><\/pre>\n<p>We now need to normalize the content of the lists.<\/p>\n<pre id=\"closings-04\"><code class=\"language-r\">map(pgs, content) %&gt;%\r\n  map(html_table) %&gt;%\r\n  map(~.[[1]]) %&gt;%\r\n  map_df(select, abb=3, .id = &quot;store&quot;) -&gt; closings<\/code><\/pre>\n<p>We&#8217;re ultimately just looking for city\/state for this simple exercise, but one could do more precise geolocation (perhaps with <a href=\"https:\/\/github.com\/hrbrmstr\/rgeocodio\"><code>rgeocodio<\/code><\/a>) and combine that with local population data, job loss estimates, current unemployment levels, etc. to make a <em>real<\/em> story out of the closings vs just do the easy thing and publish a list of stores.<\/p>\n<pre id=\"closings-05\"><code class=\"language-r\">count(closings, abb) %&gt;%\r\n  left_join(data_frame(name = state.name, abb = state.abb)) %&gt;%\r\n  left_join(usmap::statepop, by = c(&quot;abb&quot;=&quot;abbr&quot;)) %&gt;%\r\n  mutate(per_capita = (n\/pop_2015) * 1000000) %&gt;%\r\n  select(name, n, per_capita) -&gt; closings_by_state<\/code><\/pre>\n<p>(NOTE: you can get the code for the entire Rmd via <a href=\"http:\/\/rpubs.com\/hrbrmstr\/stores_2017\">RPubs<\/a> or <a href=\"https:\/\/gist.github.com\/hrbrmstr\/880f609aa084b56c7f0326a6ee1c4c59\">GitHub<\/a>)<\/p>\n<p><iframe src=\"https:\/\/rud.is\/b\/iframes\/jcp\/just_tabs.html\" seamless width=\"100%\" height=1250><\/iframe><\/p>\n<h3>Compared to unemployment\/underutilization<\/h3>\n<p>I&#8217;d have used the <a href=\"https:\/\/cran.rstudio.com\/web\/packages\/epidata\/\"><code>epidata<\/code><\/a> package to get the current state unemployment data but it&#8217;s not <em>quite<\/em> current enough, so we can either use a package to get data from the Bureau of Labor Statistics or just scrape it. A quick coin-flip says we&#8217;ll scrape the data.<\/p>\n<p>We&#8217;ll use the U-6 rate since that is an expanded definition of &#8220;underutilization&#8221; including <em>&#8220;total unemployed, plus all marginally attached workers, plus total employed part time for economic reasons, as a percent of the civilian labor force plus all marginally attached workers&#8221;<\/em> and is likely to more representative for the populations working at retail chains. I could be wrong. I only play an economist on ?. If you are an economist, please drop a note telling me where I errd in my thinking ?<\/p>\n<pre id=\"closings-06\"><code class=\"language-r\">pg &lt;- read_html(&quot;https:\/\/www.bls.gov\/lau\/stalt16q4.htm&quot;)\r\n\r\nhtml_nodes(pg, &quot;table#alternmeas16\\\\:IV&quot;) %&gt;% \r\n  html_table(header = TRUE, fill = TRUE) %&gt;%\r\n  .[[1]] %&gt;% \r\n  docxtractr::assign_colnames(1) %&gt;% \r\n  rename(name=State) %&gt;% \r\n  as_data_frame() %&gt;% \r\n  slice(2:52) %&gt;% \r\n  type_convert() %&gt;% \r\n  left_join(closings_by_state, by=&quot;name&quot;) %&gt;% \r\n  filter(!is.na(n)) -&gt; with_unemp\r\n\r\nggplot(with_unemp, aes(per_capita, `U-6`)) +\r\n  geom_label(aes(label=name), fill=&quot;#8c96c6&quot;, color=&quot;white&quot;, size=3.5, family=font_rc) +\r\n  scale_x_continuous(limits=c(-0.125, 6.75)) +\r\n  labs(x=&quot;Closings per-capita (1MM)&quot;, \r\n       y=&quot;BLS Labor Underutilization (U-6 rate)&quot;,\r\n       title=&quot;Per-capita store closings compared to current BLS U-6 Rate&quot;) +\r\n  theme_ipsum_rc(grid=&quot;XY&quot;)<\/code><\/pre>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5186\" data-permalink=\"https:\/\/rud.is\/b\/2017\/03\/19\/exploring-2017-retail-store-closings-with-r\/bls-1\/\" data-orig-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/03\/bls-1.png?fit=1536%2C1344&amp;ssl=1\" data-orig-size=\"1536,1344\" 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=\"bls-1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/03\/bls-1.png?fit=510%2C446&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/03\/bls-1.png?resize=510%2C446&#038;ssl=1\" alt=\"\" width=\"510\" height=\"446\" class=\"aligncenter size-full wp-image-5186\" \/><\/p>\n<p>If I were a reporter (again, I only play one on ?), I think I&#8217;d be digging a bit deeper on the impact of these (and the half-dozen or so other) retailers closing locations in New Mexico, Nevada, West Virginia, Wyoming, (mebbe Maine, though I&#8217;m super-b ased :-), North Dakota &amp; South Dakota. I also hope @Marketplace does a few more stories on the changing retail landscape in the U.S. over the coming months to see if there are any overt consequences to the loss of jobs and anchor stores.<\/p>\n<p>If you end up tinkering with the data, drop a note in the comments if something you discover piques your interest. For those interested in potentially marrying the data up with some additional cartography, there should be enough precision the store lists to get distinct enough lat\/lon paris after geocoding (I did a quick test with <code>rgeocodio<\/code>) to make some interesting map views, especially if you can find more store closing lists.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A story about one of the retail chains (J.C. Penny) releasing their list of stores closing in 2017 crossed paths with my Feedly reading list today and jogged my memory that there were a number of chains closing many of their doors this year, and I wanted to see the impact that might have on [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5186,"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":[91],"tags":[810],"class_list":["post-5178","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-r","tag-post"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Exploring 2017 Retail Store Closings 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\/2017\/03\/19\/exploring-2017-retail-store-closings-with-r\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Exploring 2017 Retail Store Closings with R - rud.is\" \/>\n<meta property=\"og:description\" content=\"A story about one of the retail chains (J.C. Penny) releasing their list of stores closing in 2017 crossed paths with my Feedly reading list today and jogged my memory that there were a number of chains closing many of their doors this year, and I wanted to see the impact that might have on [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/rud.is\/b\/2017\/03\/19\/exploring-2017-retail-store-closings-with-r\/\" \/>\n<meta property=\"og:site_name\" content=\"rud.is\" \/>\n<meta property=\"article:published_time\" content=\"2017-03-19T17:57:46+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-03-07T22:21:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/03\/bls-1.png?fit=1536%2C1344&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"1536\" \/>\n\t<meta property=\"og:image:height\" content=\"1344\" \/>\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=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2017\\\/03\\\/19\\\/exploring-2017-retail-store-closings-with-r\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2017\\\/03\\\/19\\\/exploring-2017-retail-store-closings-with-r\\\/\"},\"author\":{\"name\":\"hrbrmstr\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#\\\/schema\\\/person\\\/d7cb7487ab0527447f7fda5c423ff886\"},\"headline\":\"Exploring 2017 Retail Store Closings with R\",\"datePublished\":\"2017-03-19T17:57:46+00:00\",\"dateModified\":\"2018-03-07T22:21:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2017\\\/03\\\/19\\\/exploring-2017-retail-store-closings-with-r\\\/\"},\"wordCount\":663,\"commentCount\":9,\"publisher\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#\\\/schema\\\/person\\\/d7cb7487ab0527447f7fda5c423ff886\"},\"image\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2017\\\/03\\\/19\\\/exploring-2017-retail-store-closings-with-r\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2017\\\/03\\\/bls-1.png?fit=1536%2C1344&ssl=1\",\"keywords\":[\"post\"],\"articleSection\":[\"R\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/rud.is\\\/b\\\/2017\\\/03\\\/19\\\/exploring-2017-retail-store-closings-with-r\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2017\\\/03\\\/19\\\/exploring-2017-retail-store-closings-with-r\\\/\",\"url\":\"https:\\\/\\\/rud.is\\\/b\\\/2017\\\/03\\\/19\\\/exploring-2017-retail-store-closings-with-r\\\/\",\"name\":\"Exploring 2017 Retail Store Closings with R - rud.is\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2017\\\/03\\\/19\\\/exploring-2017-retail-store-closings-with-r\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2017\\\/03\\\/19\\\/exploring-2017-retail-store-closings-with-r\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2017\\\/03\\\/bls-1.png?fit=1536%2C1344&ssl=1\",\"datePublished\":\"2017-03-19T17:57:46+00:00\",\"dateModified\":\"2018-03-07T22:21:48+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2017\\\/03\\\/19\\\/exploring-2017-retail-store-closings-with-r\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/rud.is\\\/b\\\/2017\\\/03\\\/19\\\/exploring-2017-retail-store-closings-with-r\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2017\\\/03\\\/19\\\/exploring-2017-retail-store-closings-with-r\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2017\\\/03\\\/bls-1.png?fit=1536%2C1344&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2017\\\/03\\\/bls-1.png?fit=1536%2C1344&ssl=1\",\"width\":1536,\"height\":1344},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2017\\\/03\\\/19\\\/exploring-2017-retail-store-closings-with-r\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/rud.is\\\/b\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Exploring 2017 Retail Store Closings 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":"Exploring 2017 Retail Store Closings 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\/2017\/03\/19\/exploring-2017-retail-store-closings-with-r\/","og_locale":"en_US","og_type":"article","og_title":"Exploring 2017 Retail Store Closings with R - rud.is","og_description":"A story about one of the retail chains (J.C. Penny) releasing their list of stores closing in 2017 crossed paths with my Feedly reading list today and jogged my memory that there were a number of chains closing many of their doors this year, and I wanted to see the impact that might have on [&hellip;]","og_url":"https:\/\/rud.is\/b\/2017\/03\/19\/exploring-2017-retail-store-closings-with-r\/","og_site_name":"rud.is","article_published_time":"2017-03-19T17:57:46+00:00","article_modified_time":"2018-03-07T22:21:48+00:00","og_image":[{"width":1536,"height":1344,"url":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/03\/bls-1.png?fit=1536%2C1344&ssl=1","type":"image\/png"}],"author":"hrbrmstr","twitter_card":"summary_large_image","twitter_misc":{"Written by":"hrbrmstr","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/rud.is\/b\/2017\/03\/19\/exploring-2017-retail-store-closings-with-r\/#article","isPartOf":{"@id":"https:\/\/rud.is\/b\/2017\/03\/19\/exploring-2017-retail-store-closings-with-r\/"},"author":{"name":"hrbrmstr","@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"headline":"Exploring 2017 Retail Store Closings with R","datePublished":"2017-03-19T17:57:46+00:00","dateModified":"2018-03-07T22:21:48+00:00","mainEntityOfPage":{"@id":"https:\/\/rud.is\/b\/2017\/03\/19\/exploring-2017-retail-store-closings-with-r\/"},"wordCount":663,"commentCount":9,"publisher":{"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"image":{"@id":"https:\/\/rud.is\/b\/2017\/03\/19\/exploring-2017-retail-store-closings-with-r\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/03\/bls-1.png?fit=1536%2C1344&ssl=1","keywords":["post"],"articleSection":["R"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/rud.is\/b\/2017\/03\/19\/exploring-2017-retail-store-closings-with-r\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/rud.is\/b\/2017\/03\/19\/exploring-2017-retail-store-closings-with-r\/","url":"https:\/\/rud.is\/b\/2017\/03\/19\/exploring-2017-retail-store-closings-with-r\/","name":"Exploring 2017 Retail Store Closings with R - rud.is","isPartOf":{"@id":"https:\/\/rud.is\/b\/#website"},"primaryImageOfPage":{"@id":"https:\/\/rud.is\/b\/2017\/03\/19\/exploring-2017-retail-store-closings-with-r\/#primaryimage"},"image":{"@id":"https:\/\/rud.is\/b\/2017\/03\/19\/exploring-2017-retail-store-closings-with-r\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/03\/bls-1.png?fit=1536%2C1344&ssl=1","datePublished":"2017-03-19T17:57:46+00:00","dateModified":"2018-03-07T22:21:48+00:00","breadcrumb":{"@id":"https:\/\/rud.is\/b\/2017\/03\/19\/exploring-2017-retail-store-closings-with-r\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/rud.is\/b\/2017\/03\/19\/exploring-2017-retail-store-closings-with-r\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/rud.is\/b\/2017\/03\/19\/exploring-2017-retail-store-closings-with-r\/#primaryimage","url":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/03\/bls-1.png?fit=1536%2C1344&ssl=1","contentUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/03\/bls-1.png?fit=1536%2C1344&ssl=1","width":1536,"height":1344},{"@type":"BreadcrumbList","@id":"https:\/\/rud.is\/b\/2017\/03\/19\/exploring-2017-retail-store-closings-with-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/rud.is\/b\/"},{"@type":"ListItem","position":2,"name":"Exploring 2017 Retail Store Closings 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\/2017\/03\/bls-1.png?fit=1536%2C1344&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p23idr-1lw","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":6067,"url":"https:\/\/rud.is\/b\/2017\/06\/05\/r%e2%81%b6-scraping-images-to-pdfs\/","url_meta":{"origin":5178,"position":0},"title":"R\u2076 \u2014 Scraping Images To PDFs","author":"hrbrmstr","date":"2017-06-05","format":false,"excerpt":"I've been doing intermittent prep work for a follow-up to an earlier post on store closings and came across this CNN Money \"article\" on it. Said \"article\" is a deliberately obfuscated or lazily crafted series of GIF images that contain all the Radio Shack impending store closings. It's the most\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":[]},{"id":5835,"url":"https:\/\/rud.is\/b\/2017\/04\/21\/shuttering-pies-with-retiring-stores\/","url_meta":{"origin":5178,"position":1},"title":"Shuttering Pies With Retiring Stores","author":"hrbrmstr","date":"2017-04-21","format":false,"excerpt":"I caught this \"gem\" in the Wall Street Journal tonight: It's pretty hard to compare store-to-store, even though it is fairly clear which ones are going-going-gone. If we want to see the relative percentage of each store closing and also want to see how they stack up against each other,\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\/2017\/04\/RStudio.png?fit=1200%2C755&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/04\/RStudio.png?fit=1200%2C755&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/04\/RStudio.png?fit=1200%2C755&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/04\/RStudio.png?fit=1200%2C755&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/04\/RStudio.png?fit=1200%2C755&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":12700,"url":"https:\/\/rud.is\/b\/2020\/03\/26\/the-waffle-house-index\/","url_meta":{"origin":5178,"position":2},"title":"The Waffle House Index","author":"hrbrmstr","date":"2020-03-26","format":false,"excerpt":"Waffle House announced it was closing hundreds of stores this week due to SARS-Cov-2 (a.k.a COVID-19). This move garnered quite a bit of media attention since former FEMA Administrator Craig Fugate used the restaurant chain as both an indicator of the immediate and overall severity of a natural disaster. [He's\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\/2020\/03\/wh-map-2.png?fit=1200%2C1121&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2020\/03\/wh-map-2.png?fit=1200%2C1121&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2020\/03\/wh-map-2.png?fit=1200%2C1121&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2020\/03\/wh-map-2.png?fit=1200%2C1121&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2020\/03\/wh-map-2.png?fit=1200%2C1121&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":12216,"url":"https:\/\/rud.is\/b\/2019\/05\/21\/add-dressbarn-to-the-continued-retailpocalypse\/","url_meta":{"origin":5178,"position":3},"title":"Add Dressbarn to the Continued Retailpocalypse","author":"hrbrmstr","date":"2019-05-21","format":false,"excerpt":"I've talked about the retailpocalypse before and this morning I was greeted with the news about Dressbarn closing all 650 stores as I fired up a browser. I tweeted some pix and data but not everyone is on Twitter so I'm just posting a blog-blurb here with the code and\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\/2019\/05\/dressbarn-per-capita-heatmap.png?fit=1200%2C844&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/dressbarn-per-capita-heatmap.png?fit=1200%2C844&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/dressbarn-per-capita-heatmap.png?fit=1200%2C844&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/dressbarn-per-capita-heatmap.png?fit=1200%2C844&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/dressbarn-per-capita-heatmap.png?fit=1200%2C844&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":11825,"url":"https:\/\/rud.is\/b\/2019\/01\/29\/acquisitions-and-supply-chains-the-achilles-heel-of-product-organizational-security\/","url_meta":{"origin":5178,"position":4},"title":"Acquisitions and Supply Chains: The Achilles&#8217; heel of Product\/Organizational Security","author":"hrbrmstr","date":"2019-01-29","format":false,"excerpt":"(A reminder to folks expecting \"R\"\/\"data science\" content: the feed for that is at https:\/\/rud.is\/b\/category\/r\/feed\/ if you don't want to see the occasional non-R\/datasci posts.) Over at the $WORK blog we posted some research into the fairly horrible Cisco RV320\/RV325 router vulnerability. The work blog is the work blog and\u2026","rel":"","context":"In &quot;Cybersecurity&quot;","block_context":{"text":"Cybersecurity","link":"https:\/\/rud.is\/b\/category\/cybersecurity\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":5801,"url":"https:\/\/rud.is\/b\/2017\/04\/13\/come-fly-with-me-well-not-really-comparing-involuntary-disembarking-rates-across-u-s-airlines-in-r\/","url_meta":{"origin":5178,"position":5},"title":"Come Fly With Me (well, not really) \u2014 Comparing Involuntary Disembarking Rates Across U.S. Airlines in R","author":"hrbrmstr","date":"2017-04-13","format":false,"excerpt":"By now, word of the forcible deplanement of a medical professional by United has reached even the remotest of outposts in the #rstats universe. Since the news brought this practice to global attention, I found some aggregate U.S. Gov data made a quick, annual, aggregate look at this soon after\u2026","rel":"","context":"In &quot;data wrangling&quot;","block_context":{"text":"data wrangling","link":"https:\/\/rud.is\/b\/category\/data-wrangling\/"},"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\/5178","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=5178"}],"version-history":[{"count":0,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/5178\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/media\/5186"}],"wp:attachment":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/media?parent=5178"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/categories?post=5178"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/tags?post=5178"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}