

{"id":3117,"date":"2014-11-16T17:35:44","date_gmt":"2014-11-16T22:35:44","guid":{"rendered":"http:\/\/rud.is\/b\/?p=3117"},"modified":"2020-04-03T10:31:13","modified_gmt":"2020-04-03T15:31:13","slug":"moving-the-earth-well-alaska-hawaii-with-r","status":"publish","type":"post","link":"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/","title":{"rendered":"Moving The Earth (well, Alaska &#038; Hawaii) With R"},"content":{"rendered":"<p>In a <a href=\"https:\/\/rud.is\/b\/2014\/09\/26\/overcoming-d3-cartographic-envy-with-r-ggplot\/\">previous post<\/a> we looked at how to use D3 TopoJSON files with R and make some very D3-esque maps. I mentioned that one thing missing was moving Alaska &amp; Hawaii a bit closer to the continental United States and this post shows you how to do that.<\/p>\n<p>The D3 folks have it easy. They just use the built in <a href=\"https:\/\/github.com\/d3\/d3\/wiki#albersUsa\">modified Albers composite projection<\/a>. We R folk have to roll up our sleeves a bit (but not much) to do the same. Thankfully, we can do most of the work with the <span class=\"removed_link\" title=\"http:\/\/www.inside-r.org\/packages\/cran\/maptools\/docs\/elide\">elide<\/span> (&#8220;ih lied&#8221;) function from the <code>maptools<\/code> package.<\/p>\n<p>We&#8217;ll start with some package imports:<\/p>\n<pre><code class=\"language-r\">library(maptools)\nlibrary(mapproj)\nlibrary(rgeos)\nlibrary(rgdal)\nlibrary(RColorBrewer)\nlibrary(gthemes)\nlibrary(ggplot2)\n<\/code><\/pre>\n<p>I&#8217;m using a GeoJSON file that I made from the <a href=\"https:\/\/www.census.gov\/geo\/maps-data\/data\/cbf\/cbf_counties.html\">2013 US Census shapefile<\/a>. I prefer GeoJSON mostly due to it being single file and the easy conversion to TopoJSON if I ever need to use the same map in a D3 context (I work with information security data most of the time, so I rarely have to use maps at all for the day job). I simplified the polygons a bit (passing <code>-simplify 0.01<\/code> to <code>ogr2ogr<\/code>) to reduce processing time.<\/p>\n<p>We read in that file and then transform the projection to Albers equal area and join the polygon ids to the shapefile data frame:<\/p>\n<pre><code class=\"language-r\"># https:\/\/www.census.gov\/geo\/maps-data\/data\/cbf\/cbf_counties.html\n# read U.S. counties moderately-simplified GeoJSON file\nus &lt;- readOGR(dsn=\"data\/us.geojson\", layer=\"OGRGeoJSON\")\n\n# convert it to Albers equal area\nus_aea &lt;- spTransform(us, CRS(\"+proj=laea +lat_0=45 +lon_0=-100 +x_0=0 +y_0=0 +a=6370997 +b=6370997 +units=m +no_defs\"))\nus_aea@data$id &lt;- rownames(us_aea@data)\n<\/code><\/pre>\n<p>Now, to move Alaska &amp; Hawaii, we have to:<\/p>\n<ul>\n<li>extract them from the main shapefile data frame<\/li>\n<li>perform rotation, scaling and transposing on them<\/li>\n<li>ensure they have the right projection set<\/li>\n<li>merge them back into the original spatial data frame<\/li>\n<\/ul>\n<p>The <code>elide<\/code> function has parameters for all the direct shape munging, so we&#8217;ll just do that for both states. I took a peek at the D3 source code for the Albers projection to get a feel for the parameters. You can tweak those if you want them in other positions or feel the urge to change the Alaska rotation angle.<\/p>\n<pre><code class=\"language-r\"># extract, then rotate, shrink &amp; move alaska (and reset projection)\n# need to use state IDs via # https:\/\/www.census.gov\/geo\/reference\/ansi_statetables.html\nalaska &lt;- us_aea[us_aea$STATEFP==\"02\",]\nalaska &lt;- elide(alaska, rotate=-50)\nalaska &lt;- elide(alaska, scale=max(apply(bbox(alaska), 1, diff)) \/ 2.3)\nalaska &lt;- elide(alaska, shift=c(-2100000, -2500000))\nproj4string(alaska) &lt;- proj4string(us_aea)\n\n# extract, then rotate &amp; shift hawaii\nhawaii &lt;- us_aea[us_aea$STATEFP==\"15\",]\nhawaii &lt;- elide(hawaii, rotate=-35)\nhawaii &lt;- elide(hawaii, shift=c(5400000, -1400000))\nproj4string(hawaii) &lt;- proj4string(us_aea)\n\n# remove old states and put new ones back in; note the different order\n# we're also removing puerto rico in this example but you can move it\n# between texas and florida via similar methods to the ones we just used\nus_aea &lt;- us_aea[!us_aea$STATEFP %in% c(\"02\", \"15\", \"72\"),]\nus_aea &lt;- rbind(us_aea, alaska, hawaii)\n<\/code><\/pre>\n<p>Rather than just show the resultant plain county map, we&#8217;ll add some data to it. The first example uses US drought data (from November 11th, 2014). Drought conditions are pretty severe in some states, but we&#8217;ll just show areas that have any type of drought (levels D0-D4). The color ramp shows the % of drought coverage in each county (you&#8217;ll need a browser that can display SVGs to see the maps):<\/p>\n<pre><code class=\"language-r\"># get some data to show...perhaps drought data via:\n# http:\/\/droughtmonitor.unl.edu\/MapsAndData\/GISData.aspx\ndroughts &lt;- read.csv(\"data\/dm_export_county_20141111.csv\")\ndroughts$id &lt;- sprintf(\"%05d\", as.numeric(as.character(droughts$FIPS)))\ndroughts$total &lt;- with(droughts, (D0+D1+D2+D3+D4)\/5)\n\n# get ready for ggplotting it... this takes a cpl seconds\nmap &lt;- fortify(us_aea, region=\"GEOID\")\n\n# plot it\ngg &lt;- ggplot()\ngg &lt;- gg + geom_map(data=map, map=map,\n                    aes(x=long, y=lat, map_id=id, group=group),\n                    fill=\"#ffffff\", color=\"#0e0e0e\", size=0.15)\ngg &lt;- gg + geom_map(data=droughts, map=map, aes(map_id=id, fill=total),\n                    color=\"#0e0e0e\", size=0.15)\ngg &lt;- gg + scale_fill_gradientn(colours=c(\"#ffffff\", brewer.pal(n=9, name=\"YlOrRd\")),\n                                na.value=\"#ffffff\", name=\"% of County\")\ngg &lt;- gg + labs(title=\"U.S. Areas of Drought (all levels, % county coverage)\")\ngg &lt;- gg + coord_equal()\ngg &lt;- gg + theme_map()\ngg &lt;- gg + theme(legend.position=\"right\")\ngg &lt;- gg + theme(plot.title=element_text(size=16))\ngg\n<\/code><\/pre>\n<p><center><a href=\"https:\/\/rud.is\/dl\/drought.svg\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/rud.is\/dl\/drought.svg\" alt=\"img\" \/><\/a><\/center><\/p>\n<p>While that shows Alaska &amp; Hawaii in D3-Albers-style, it would be more convincing if we actually used the FIPS county codes on Alaska &amp; Hawaii, so we&#8217;ll riff off the previous post and make a county land-mass area choropleth (since we have the land mass area data available in the GeoJSON file):<\/p>\n<pre><code class=\"language-r\">gg &lt;- ggplot()\ngg &lt;- gg + geom_map(data=map, map=map,\n                    aes(x=long, y=lat, map_id=id, group=group),\n                    fill=\"white\", color=\"white\", size=0.15)\ngg &lt;- gg + geom_map(data=us_aea@data, map=map, aes(map_id=GEOID, fill=log(ALAND)),\n                    color=\"white\", size=0.15)\ngg &lt;- gg + scale_fill_gradientn(colours=c(brewer.pal(n=9, name=\"YlGn\")),\n                                na.value=\"#ffffff\", name=\"County Land\\nMass Area (log)\")\ngg &lt;- gg + labs(title=\"U.S. County Area Choropleth (log scale)\")\ngg &lt;- gg + coord_equal()\ngg &lt;- gg + theme_map()\ngg &lt;- gg + theme(legend.position=\"right\")\ngg &lt;- gg + theme(plot.title=element_text(size=16))\ngg\n<\/code><\/pre>\n<p><center><a href=\"https:\/\/rud.is\/dl\/area.svg\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/rud.is\/dl\/area.svg\" alt=\"img\" \/><\/a><\/center><\/p>\n<p>Now, you have one less reason to be envious of the D3 cool kids!<\/p>\n<p>The code &amp; shapefiles are available <a href=\"https:\/\/github.com\/hrbrmstr\/rd3albers\">on github<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In a previous post we looked at how to use D3 TopoJSON files with R and make some very D3-esque maps. I mentioned that one thing missing was moving Alaska &amp; Hawaii a bit closer to the continental United States and this post shows you how to do that. The D3 folks have it easy. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"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":[666,673,674,706,91],"tags":[810],"class_list":["post-3117","post","type-post","status-publish","format-standard","hentry","category-d3","category-datavis-2","category-dataviz","category-maps","category-r","tag-post"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Moving The Earth (well, Alaska &amp; Hawaii) 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\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Moving The Earth (well, Alaska &amp; Hawaii) With R - rud.is\" \/>\n<meta property=\"og:description\" content=\"In a previous post we looked at how to use D3 TopoJSON files with R and make some very D3-esque maps. I mentioned that one thing missing was moving Alaska &amp; Hawaii a bit closer to the continental United States and this post shows you how to do that. The D3 folks have it easy. [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/\" \/>\n<meta property=\"og:site_name\" content=\"rud.is\" \/>\n<meta property=\"article:published_time\" content=\"2014-11-16T22:35:44+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-04-03T15:31:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/rud.is\/dl\/drought.svg\" \/>\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=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/\"},\"author\":{\"name\":\"hrbrmstr\",\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\"},\"headline\":\"Moving The Earth (well, Alaska &#038; Hawaii) With R\",\"datePublished\":\"2014-11-16T22:35:44+00:00\",\"dateModified\":\"2020-04-03T15:31:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/\"},\"wordCount\":467,\"commentCount\":7,\"publisher\":{\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\"},\"image\":{\"@id\":\"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/rud.is\/dl\/drought.svg\",\"keywords\":[\"post\"],\"articleSection\":[\"d3\",\"DataVis\",\"DataViz\",\"maps\",\"R\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/\",\"url\":\"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/\",\"name\":\"Moving The Earth (well, Alaska & Hawaii) With R - rud.is\",\"isPartOf\":{\"@id\":\"https:\/\/rud.is\/b\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/rud.is\/dl\/drought.svg\",\"datePublished\":\"2014-11-16T22:35:44+00:00\",\"dateModified\":\"2020-04-03T15:31:13+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/#primaryimage\",\"url\":\"https:\/\/rud.is\/dl\/drought.svg\",\"contentUrl\":\"https:\/\/rud.is\/dl\/drought.svg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/rud.is\/b\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Moving The Earth (well, Alaska &#038; Hawaii) 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":"Moving The Earth (well, Alaska & Hawaii) 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\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/","og_locale":"en_US","og_type":"article","og_title":"Moving The Earth (well, Alaska & Hawaii) With R - rud.is","og_description":"In a previous post we looked at how to use D3 TopoJSON files with R and make some very D3-esque maps. I mentioned that one thing missing was moving Alaska &amp; Hawaii a bit closer to the continental United States and this post shows you how to do that. The D3 folks have it easy. [&hellip;]","og_url":"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/","og_site_name":"rud.is","article_published_time":"2014-11-16T22:35:44+00:00","article_modified_time":"2020-04-03T15:31:13+00:00","og_image":[{"url":"https:\/\/rud.is\/dl\/drought.svg","type":"","width":"","height":""}],"author":"hrbrmstr","twitter_card":"summary_large_image","twitter_misc":{"Written by":"hrbrmstr","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/#article","isPartOf":{"@id":"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/"},"author":{"name":"hrbrmstr","@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"headline":"Moving The Earth (well, Alaska &#038; Hawaii) With R","datePublished":"2014-11-16T22:35:44+00:00","dateModified":"2020-04-03T15:31:13+00:00","mainEntityOfPage":{"@id":"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/"},"wordCount":467,"commentCount":7,"publisher":{"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"image":{"@id":"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/#primaryimage"},"thumbnailUrl":"https:\/\/rud.is\/dl\/drought.svg","keywords":["post"],"articleSection":["d3","DataVis","DataViz","maps","R"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/","url":"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/","name":"Moving The Earth (well, Alaska & Hawaii) With R - rud.is","isPartOf":{"@id":"https:\/\/rud.is\/b\/#website"},"primaryImageOfPage":{"@id":"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/#primaryimage"},"image":{"@id":"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/#primaryimage"},"thumbnailUrl":"https:\/\/rud.is\/dl\/drought.svg","datePublished":"2014-11-16T22:35:44+00:00","dateModified":"2020-04-03T15:31:13+00:00","breadcrumb":{"@id":"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/#primaryimage","url":"https:\/\/rud.is\/dl\/drought.svg","contentUrl":"https:\/\/rud.is\/dl\/drought.svg"},{"@type":"BreadcrumbList","@id":"https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/rud.is\/b\/"},{"@type":"ListItem","position":2,"name":"Moving The Earth (well, Alaska &#038; Hawaii) 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":"","jetpack_shortlink":"https:\/\/wp.me\/p23idr-Oh","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":4217,"url":"https:\/\/rud.is\/b\/2016\/03\/29\/easier-composite-u-s-choropleths-with-albersusa\/","url_meta":{"origin":3117,"position":0},"title":"Easier Composite U.S. Choropleths with albersusa","author":"hrbrmstr","date":"2016-03-29","format":false,"excerpt":"Folks who've been tracking this blog on R-bloggers probably remember [this post](https:\/\/rud.is\/b\/2014\/11\/16\/moving-the-earth-well-alaska-hawaii-with-r\/) where I showed how to create a composite U.S. map with an Albers projection (which is commonly referred to as AlbersUSA these days thanks to D3). I'm not sure why I didn't think of this earlier, but you\u2026","rel":"","context":"In &quot;cartography&quot;","block_context":{"text":"cartography","link":"https:\/\/rud.is\/b\/category\/cartography\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/03\/Fullscreen_3_29_16__9_06_AM.png?fit=1200%2C747&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/03\/Fullscreen_3_29_16__9_06_AM.png?fit=1200%2C747&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/03\/Fullscreen_3_29_16__9_06_AM.png?fit=1200%2C747&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/03\/Fullscreen_3_29_16__9_06_AM.png?fit=1200%2C747&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/03\/Fullscreen_3_29_16__9_06_AM.png?fit=1200%2C747&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":2793,"url":"https:\/\/rud.is\/b\/2013\/11\/27\/mapping-power-outages-in-maine-with-r\/","url_meta":{"origin":3117,"position":1},"title":"Mapping Power Outages In Maine With R","author":"hrbrmstr","date":"2013-11-27","format":false,"excerpt":"UPDATE: A Shiny (dynamic) version of this is now available. We had yet-another power outage this morning due to the weird weather patterns of the week and it was the final catalyst I needed to crank out some R code to map the affected counties. Central Maine Power provides an\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\/2013\/11\/Plot_Zoom.png?fit=530%2C680&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2013\/11\/Plot_Zoom.png?fit=530%2C680&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2013\/11\/Plot_Zoom.png?fit=530%2C680&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":3028,"url":"https:\/\/rud.is\/b\/2014\/09\/20\/chartingmapping-the-scottish-vote-with-r-rvestdplyrtidyrtopojsonggplot\/","url_meta":{"origin":3117,"position":2},"title":"Charting\/Mapping the Scottish Vote with R (an rvest\/dplyr\/tidyr\/TopoJSON\/ggplot tutorial)","author":"hrbrmstr","date":"2014-09-20","format":false,"excerpt":"The BBC did a pretty good job [live tracking the Scotland secession vote](http:\/\/www.bbc.com\/news\/events\/scotland-decides\/results), but I really didn't like the color scheme they chose and decided to use the final tally site as the basis for another tutorial using the tools from the Hadleyverse and taking advantage of the fact that\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":3563,"url":"https:\/\/rud.is\/b\/2015\/07\/26\/making-staticinteractive-voronoi-map-layers-in-ggplotleaflet\/","url_meta":{"origin":3117,"position":3},"title":"Making Static\/Interactive Voronoi Map Layers In ggplot\/leaflet","author":"hrbrmstr","date":"2015-07-26","format":false,"excerpt":"Despite having shown various ways to overcome D3 cartographic envy, there are always more examples that can cause the green monster to rear it's ugly head. Take the Voronoi Arc Map example. For those in need of a primer, a Voronoi tesslation\/diagram is: \u2026a partitioning of a plane into regions\u2026","rel":"","context":"In &quot;cartography&quot;","block_context":{"text":"cartography","link":"https:\/\/rud.is\/b\/category\/cartography\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2846,"url":"https:\/\/rud.is\/b\/2013\/12\/27\/points-polygons-and-power-outages\/","url_meta":{"origin":3117,"position":4},"title":"Points, Polygons and Power Outages","author":"hrbrmstr","date":"2013-12-27","format":false,"excerpt":"Most of my free coding time has been spent tweaking a D3-based live power outage tracker for Central Maine Power customers (there's also a woefully less-featured Shiny app for it, too). There is some R associated with the D3 vis, but it's limited to a cron job that's makes the\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":"","width":0,"height":0},"classes":[]},{"id":3054,"url":"https:\/\/rud.is\/b\/2014\/09\/26\/overcoming-d3-cartographic-envy-with-r-ggplot\/","url_meta":{"origin":3117,"position":5},"title":"Overcoming D3 Cartographic Envy With R + ggplot","author":"hrbrmstr","date":"2014-09-26","format":false,"excerpt":"When I used one of the Scotland TopoJSON files for a recent post, it really hit me just how much D3 cartography envy I had\/have as an R user. Don't get me wrong, I can conjure up D3 maps pretty well [1] [2] and the utility of an interactive map\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":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/3117","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=3117"}],"version-history":[{"count":0,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/3117\/revisions"}],"wp:attachment":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/media?parent=3117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/categories?post=3117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/tags?post=3117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}