

{"id":3679,"date":"2015-09-19T14:34:10","date_gmt":"2015-09-19T19:34:10","guid":{"rendered":"http:\/\/rud.is\/b\/?p=3679"},"modified":"2018-03-10T08:01:38","modified_gmt":"2018-03-10T13:01:38","slug":"a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats","status":"publish","type":"post","link":"https:\/\/rud.is\/b\/2015\/09\/19\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\/","title":{"rendered":"A Package Full o&#8217; Pirates &#038; Makin&#8217; Interactive Pirate Maps in arrrrrRstats"},"content":{"rendered":"<p>Avast, me hearties! It&#8217;s time four t&#8217; annual International Talk Like a Pirate Day <code>#rstats<\/code> post!<\/p>\n<p>(OK, I won&#8217;t make you suffer continuous pirate-speak for the entire post)<\/p>\n<p>I tried to be a bit more practical this year and have two treasuRe chests for you to (hopefully) enjoy.<\/p>\n<h3>A Package Full o&#8217; Pirates<\/h3>\n<p>I&#8217;ve covered the Anti-shipping Activity Messages (ASAM) Database <a href=\"https:\/\/rud.is\/b\/2013\/09\/19\/animated-irl-pirate-attacks-in-r\/\">before<\/a> for TLAPD before but getting, updating and working with the data has more pain points than it should, so I wrapped a <a href=\"https:\/\/github.com\/hrbrmstr\/asam\">small package<\/a> around it.<\/p>\n<p>Here&#8217;s how to get all <em>pirate<\/em> attacks this year (2015) so far:<\/p>\n<pre lang=\"rsplus\"># devtools::install_github(\"hrbrmstr\/asam\")\nlibrary(asam)\n\ndata(asam_shp)\npirates <- subset(asam_shp,\n                  grepl(\"pirate\", Aggressor, ignore.case=TRUE) &#038;\n                  format(DateOfOcc, \"%Y\") == \"2015\")\n\nnrow(pirates)\n## [1] 78<\/pre>\n<p>It looks like there have been 78 registered pirate attacks this year. The National Geospatial Intelligence Agency (NGIA) marks the attacks by lat\/lon <em>and<\/em> also by region\/subregion, and I managed to obtain the official polygons for these regions, so we can plot these attacks on a world map and also show the subregions:<\/p>\n<pre lang=\"rsplus\">library(ggplot2)\n\n# get the ASAM subregion polygons\nsubregions <- asam_subregions()\nsubregions_map <- fortify(subregions)\n\n# get the world map\nworld <- map_data(\"world\")\n\n# get the points for the pirate attack occurrences\npirate_pts <- data.frame(pirates)\n\ngg <- ggplot()\n\n# world map layer\ngg <- gg + geom_map(data=world, map=world,\n                    aes(x=long, y=lat, map_id=region),\n                    color=\"black\", fill=\"#e7e7e7\", size=0.15)\n# ASAM regions layer\ngg <- gg + geom_map(data=subregions_map, map=subregions_map,\n                    aes(x=long, y=lat, map_id=id),\n                    color=\"white\", fill=\"white\", size=0.15, alpha=0)\n\n# attacks\ngg <- gg + geom_point(data=pirate_pts, color=\"black\", fill=\"yellow\", \n                      aes(x=coords.x1, y=coords.x2), shape=21)\n\ngg <- gg + xlim(-170, 170)\ngg <- gg + ylim(-58, 75)\ngg <- gg + coord_map(\"mollweide\")\ngg <- gg + theme_map()\ngg <- gg + theme(panel.background=element_rect(fill=\"steelblue\"))\ngg<\/pre>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3681\" data-permalink=\"https:\/\/rud.is\/b\/2015\/09\/19\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\/readme-map-1\/\" data-orig-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2015\/09\/README-map-1.png?fit=1920%2C864&amp;ssl=1\" data-orig-size=\"1920,864\" 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=\"README-map-1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2015\/09\/README-map-1.png?fit=510%2C230&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2015\/09\/README-map-1.png?resize=510%2C230&#038;ssl=1\" alt=\"README-map-1\" width=\"510\" height=\"230\" class=\"aligncenter size-full wp-image-3681\" \/><\/p>\n<p>There is quite a bit more data than just location, though and we can work with it <em>much<\/em> better in an interactive map.<\/p>\n<h3>Makin' Interactive Pirate Maps<\/h3>\n<p>Now, what makes the following an interactive <em>pirate<\/em> map is not so much the fact that we'll be plotting points of pirate attacks on a Leaflet map, <em>but<\/em> we'll also be using a <em>pirate treasure map theme<\/em> on the Leaflet map.<\/p>\n<p>Let's start with showing how to use a general pirate map theme before adding in the ASAM data.<\/p>\n<p>You'll have to pause here and head on over to <a href=\"https:\/\/www.mapbox.com\/\">MapBox<\/a> to register for a (free) account. You'll need to <a href=\"https:\/\/www.mapbox.com\/account\/settings\/\">go through the gyrations<\/a> to eventually get a public token and mapbox id to use the pirate map tiles they have. I store those in my <code>.Renviron<\/code> so I don't have to cut\/paste inane strings when I need to use this, or other, APIs or need to keep them from prying eyes. Since MapBox exposes these strings in <code>GET<\/code> call URLs, the use of environment variables is strictly for convenience in this case.<\/p>\n<pre lang=\"rsplus\">library(leaflet)\n\nmapbox_public_token <- Sys.getenv(\"MAPBOX_PUBLIC_TOKEN\")\nmapbox_map_id <- Sys.getenv(\"PIRATE_MAP_ID\")\nmapbox_url <- \"https:\/\/a.tiles.mapbox.com\/v4\/%s\/{z}\/{x}\/{y}.png?access_token=%s\"\nmapbox_tiles_template <- sprintf(mapbox_url, mapbox_map_id, mapbox_public_token)<\/pre>\n<p>Now, what good is a pirate map without an 'X' marking the spot for some treasure. For that we'll need an 'X':<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/rud.is\/dl\/x.png?w=510&#038;ssl=1\" alt=\"\" \/><\/p>\n<p>in a format we can use with Leaflet:<\/p>\n<pre lang=\"rsplus\">x_marker <- icons(\"http:\/\/rud.is\/dl\/x.png\",\n                  iconHeight=64, iconWidth=64,\n                  iconAnchorX=32, iconAnchorY=32)<\/pre>\n<p>Now, we can display a pirate map for all scurvy dogs to see:<\/p>\n<pre lang=\"rsplus\">leaflet() %>%\n  addTiles(mapbox_tiles_template) %>%\n  setView(lng=-50.9249, lat=45.68929, zoom=3) %>%\n  addMarkers(-70.2667, 43.6667, icon=x_marker)<\/pre>\n<p><center><\/p>\n<p><iframe loading=\"lazy\" style=\"max-width=100%\" \n        src=\"\/b\/iframes\/tlapd\/tlapd2015011.html\" \n        sandbox=\"allow-same-origin \n        allow-scripts\" width=\"100%\" \n        height=\"500\" \n        scrolling=\"no\" \n        seamless=\"seamless\" \n        frameBorder=\"0\"><\/iframe><\/p>\n<p><\/center><\/p>\n<p><em>NOTE:<\/em> I have <em>not<\/em> buried treasure in Portland, Maine, but go nuts digging at that location if you still want to.<\/p>\n<h3>Pirates on Pirate Maps<\/h3>\n<p>We can make a [crude] interactive ASAM browser by combining our data from above with our new, <em>pirate-y<\/em> mapping capabilities:<\/p>\n<pre lang=\"rsplus\">library(asam)\nlibrary(sp)\nlibrary(dplyr)\nlibrary(leaflet)\n\ndata(asam_shp)\ndat <- subset(asam_shp,\n              DateOfOcc > as.Date(\"2015-01-01\") &\n                grepl(\"pirate\", Aggressor, ignore.case=TRUE))\n# could also do data.frame(dat)\ndat <- bind_cols(dat@data, data.frame(coordinates(dat), stringsAsFactors=FALSE))<\/pre>\n<p>We'll build a popup with the ASAM incident description fields and add it and the pirate incident points to a pirate-themed Leaflet map:<\/p>\n<pre lang=\"rsplus\">\npopup_template <- '<div style=\"background:#f3e0b5; padding:10px\"><b>Date:<\/b> %s\n<span style=\"float:right\"><a target=\"_blank\" href=\"https:\/\/msi.nga.mil\/NGAPortal\/msi\/query_results.jsp?MSI_queryType=ASAM&amp;MSI_generalFilterType=SpecificNumber&amp;MSI_generalFilterValue=%s&amp;MSI_additionalFilterType1=None&amp;MSI_additionalFilterType2=-999&amp;MSI_additionalFilterValue1=-999&amp;MSI_additionalFilterValue2=-999&amp;MSI_outputOptionType1=SortBy&amp;MSI_outputOptionType2=-999&amp;MSI_outputOptionValue1=Date_DESC&amp;MSI_outputOptionValue2=-999&amp;MSI_MAP=-999\">ASAM Record<\/a>\n<\/span><br\/>\n<b>Victim:<\/b> %s<br\/>\n<b>Description:<\/b> %s<\/div>'\n\nnona <- function(x) ifelse(is.na(x), \" \", x)\n\npirate_pops <- sprintf(popup_template,\n                       dat$date,\n                       gsub(\"-\", \"_\", dat$Reference),\n                       dat$Victim,\n                       paste0(nona(dat$Descript),\n                              nona(dat$Desc1), nona(dat$Desc2), nona(dat$Desc3),\n                              nona(dat$Desc4), nona(dat$Desc5), nona(dat$Desc6),\n                              sep=\" \"))\n\nmapbox_public_token <- Sys.getenv(\"MAPBOX_PUBLIC_TOKEN\")\nmapbox_map_id <- Sys.getenv(\"PIRATE_MAP_ID\")\nmapbox_url <- \"https:\/\/a.tiles.mapbox.com\/v4\/%s\/{z}\/{x}\/{y}.png?access_token=%s\"\nmapbox_tiles_template <- sprintf(mapbox_url, mapbox_map_id, mapbox_public_token)\n\nleaflet() %>%\n  addTiles(mapbox_tiles_template) %>%\n  setView(lng=-50.9249, lat=45.68929, zoom=3) %>%\n  addCircles(dat$coords.x1, dat$coords.x2, radius=300,\n             color=\"#664c1f\", popup=pirate_pops)<\/pre>\n<p><center><\/p>\n<p><iframe loading=\"lazy\" style=\"max-width=100%\" \n        src=\"\/b\/iframes\/tlapd\/tlapd2015012.html\" \n        sandbox=\"allow-same-origin \n        allow-scripts\" width=\"100%\" \n        height=\"500\" \n        scrolling=\"no\" \n        seamless=\"seamless\" \n        frameBorder=\"0\"><\/iframe><\/p>\n<p><\/center><\/p>\n<p>Select any of the circle marks and you'll get a popup with a description and link to the official ASAM record (like this):<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3685\" data-permalink=\"https:\/\/rud.is\/b\/2015\/09\/19\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\/tlapd2015012_html\/\" data-orig-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2015\/09\/tlapd2015012_html.png?fit=890%2C616&amp;ssl=1\" data-orig-size=\"890,616\" 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=\"tlapd2015012_html\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2015\/09\/tlapd2015012_html.png?fit=510%2C353&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2015\/09\/tlapd2015012_html.png?resize=445%2C308&#038;ssl=1\" alt=\"tlapd2015012_html\" width=\"445\" height=\"308\" class=\"aligncenter size-full wp-image-3685\" \/><\/p>\n<h3>Fin<\/h3>\n<p>I'm not sure when I'll get back to the <code>asam<\/code> package, but it could use some attention. The <code>Aggressor<\/code> field could be auto-cleaned to make it more usable and a <code>dplyr<\/code>-esque interface could be developed to select incidents. Also, since it includes a shapefile of subregions, that could also be used to do more spatial-oriented analyses of the incidents. It's all there for any pirate lackey to pilfer.<\/p>\n<p>Drop a note in the comments if you have any of your own pirate-y creations or an issue on github for feature requests &amp; bug reports.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Avast, me hearties! It&#8217;s time four t&#8217; annual International Talk Like a Pirate Day #rstats post! (OK, I won&#8217;t make you suffer continuous pirate-speak for the entire post) I tried to be a bit more practical this year and have two treasuRe chests for you to (hopefully) enjoy. A Package Full o&#8217; Pirates I&#8217;ve covered [&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":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[721,673,674,67,706,91,762],"tags":[810],"class_list":["post-3679","post","type-post","status-publish","format-standard","hentry","category-cartography","category-datavis-2","category-dataviz","category-humor","category-maps","category-r","category-tlapd","tag-post"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>A Package Full o&#039; Pirates &amp; Makin&#039; Interactive Pirate Maps in arrrrrRstats - 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\/2015\/09\/19\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"A Package Full o&#039; Pirates &amp; Makin&#039; Interactive Pirate Maps in arrrrrRstats - rud.is\" \/>\n<meta property=\"og:description\" content=\"Avast, me hearties! It&#8217;s time four t&#8217; annual International Talk Like a Pirate Day #rstats post! (OK, I won&#8217;t make you suffer continuous pirate-speak for the entire post) I tried to be a bit more practical this year and have two treasuRe chests for you to (hopefully) enjoy. A Package Full o&#8217; Pirates I&#8217;ve covered [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/rud.is\/b\/2015\/09\/19\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\/\" \/>\n<meta property=\"og:site_name\" content=\"rud.is\" \/>\n<meta property=\"article:published_time\" content=\"2015-09-19T19:34:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-03-10T13:01:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/rud.is\/b\/wp-content\/uploads\/2015\/09\/README-map-1.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=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2015\\\/09\\\/19\\\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2015\\\/09\\\/19\\\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\\\/\"},\"author\":{\"name\":\"hrbrmstr\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#\\\/schema\\\/person\\\/d7cb7487ab0527447f7fda5c423ff886\"},\"headline\":\"A Package Full o&#8217; Pirates &#038; Makin&#8217; Interactive Pirate Maps in arrrrrRstats\",\"datePublished\":\"2015-09-19T19:34:10+00:00\",\"dateModified\":\"2018-03-10T13:01:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2015\\\/09\\\/19\\\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\\\/\"},\"wordCount\":584,\"commentCount\":4,\"publisher\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#\\\/schema\\\/person\\\/d7cb7487ab0527447f7fda5c423ff886\"},\"image\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2015\\\/09\\\/19\\\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2015\\\/09\\\/README-map-1.png\",\"keywords\":[\"post\"],\"articleSection\":[\"cartography\",\"DataVis\",\"DataViz\",\"Humor\",\"maps\",\"R\",\"TLAPD\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/rud.is\\\/b\\\/2015\\\/09\\\/19\\\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2015\\\/09\\\/19\\\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\\\/\",\"url\":\"https:\\\/\\\/rud.is\\\/b\\\/2015\\\/09\\\/19\\\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\\\/\",\"name\":\"A Package Full o' Pirates & Makin' Interactive Pirate Maps in arrrrrRstats - rud.is\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2015\\\/09\\\/19\\\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2015\\\/09\\\/19\\\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2015\\\/09\\\/README-map-1.png\",\"datePublished\":\"2015-09-19T19:34:10+00:00\",\"dateModified\":\"2018-03-10T13:01:38+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2015\\\/09\\\/19\\\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/rud.is\\\/b\\\/2015\\\/09\\\/19\\\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2015\\\/09\\\/19\\\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2015\\\/09\\\/README-map-1.png?fit=1920%2C864&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2015\\\/09\\\/README-map-1.png?fit=1920%2C864&ssl=1\",\"width\":1920,\"height\":864},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2015\\\/09\\\/19\\\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/rud.is\\\/b\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"A Package Full o&#8217; Pirates &#038; Makin&#8217; Interactive Pirate Maps in arrrrrRstats\"}]},{\"@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":"A Package Full o' Pirates & Makin' Interactive Pirate Maps in arrrrrRstats - 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\/2015\/09\/19\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\/","og_locale":"en_US","og_type":"article","og_title":"A Package Full o' Pirates & Makin' Interactive Pirate Maps in arrrrrRstats - rud.is","og_description":"Avast, me hearties! It&#8217;s time four t&#8217; annual International Talk Like a Pirate Day #rstats post! (OK, I won&#8217;t make you suffer continuous pirate-speak for the entire post) I tried to be a bit more practical this year and have two treasuRe chests for you to (hopefully) enjoy. A Package Full o&#8217; Pirates I&#8217;ve covered [&hellip;]","og_url":"https:\/\/rud.is\/b\/2015\/09\/19\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\/","og_site_name":"rud.is","article_published_time":"2015-09-19T19:34:10+00:00","article_modified_time":"2018-03-10T13:01:38+00:00","og_image":[{"url":"https:\/\/rud.is\/b\/wp-content\/uploads\/2015\/09\/README-map-1.png","type":"","width":"","height":""}],"author":"hrbrmstr","twitter_card":"summary_large_image","twitter_misc":{"Written by":"hrbrmstr","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/rud.is\/b\/2015\/09\/19\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\/#article","isPartOf":{"@id":"https:\/\/rud.is\/b\/2015\/09\/19\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\/"},"author":{"name":"hrbrmstr","@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"headline":"A Package Full o&#8217; Pirates &#038; Makin&#8217; Interactive Pirate Maps in arrrrrRstats","datePublished":"2015-09-19T19:34:10+00:00","dateModified":"2018-03-10T13:01:38+00:00","mainEntityOfPage":{"@id":"https:\/\/rud.is\/b\/2015\/09\/19\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\/"},"wordCount":584,"commentCount":4,"publisher":{"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"image":{"@id":"https:\/\/rud.is\/b\/2015\/09\/19\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\/#primaryimage"},"thumbnailUrl":"https:\/\/rud.is\/b\/wp-content\/uploads\/2015\/09\/README-map-1.png","keywords":["post"],"articleSection":["cartography","DataVis","DataViz","Humor","maps","R","TLAPD"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/rud.is\/b\/2015\/09\/19\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/rud.is\/b\/2015\/09\/19\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\/","url":"https:\/\/rud.is\/b\/2015\/09\/19\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\/","name":"A Package Full o' Pirates & Makin' Interactive Pirate Maps in arrrrrRstats - rud.is","isPartOf":{"@id":"https:\/\/rud.is\/b\/#website"},"primaryImageOfPage":{"@id":"https:\/\/rud.is\/b\/2015\/09\/19\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\/#primaryimage"},"image":{"@id":"https:\/\/rud.is\/b\/2015\/09\/19\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\/#primaryimage"},"thumbnailUrl":"https:\/\/rud.is\/b\/wp-content\/uploads\/2015\/09\/README-map-1.png","datePublished":"2015-09-19T19:34:10+00:00","dateModified":"2018-03-10T13:01:38+00:00","breadcrumb":{"@id":"https:\/\/rud.is\/b\/2015\/09\/19\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/rud.is\/b\/2015\/09\/19\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/rud.is\/b\/2015\/09\/19\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\/#primaryimage","url":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2015\/09\/README-map-1.png?fit=1920%2C864&ssl=1","contentUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2015\/09\/README-map-1.png?fit=1920%2C864&ssl=1","width":1920,"height":864},{"@type":"BreadcrumbList","@id":"https:\/\/rud.is\/b\/2015\/09\/19\/a-package-full-o-pirates-makin-interactive-pirate-maps-in-arrrrrrstats\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/rud.is\/b\/"},{"@type":"ListItem","position":2,"name":"A Package Full o&#8217; Pirates &#038; Makin&#8217; Interactive Pirate Maps in arrrrrRstats"}]},{"@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-Xl","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":2685,"url":"https:\/\/rud.is\/b\/2013\/09\/19\/animated-irl-pirate-attacks-in-r\/","url_meta":{"origin":3679,"position":0},"title":"Animated IRL Pirate Attacks In R","author":"hrbrmstr","date":"2013-09-19","format":false,"excerpt":"Avast me hearRties! (ok, enough of the pirate speak in a blog post) It wouldn't be TLAPD without out some modest code & idea pilfering from Mark Bulling & Simon Raper. While those mateys did a fine job hoisting up some R code (your really didn't think I'd stop with\u2026","rel":"","context":"In &quot;DataVis&quot;","block_context":{"text":"DataVis","link":"https:\/\/rud.is\/b\/category\/datavis-2\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":6385,"url":"https:\/\/rud.is\/b\/2017\/09\/19\/pirating-web-content-responsibly-with-r\/","url_meta":{"origin":3679,"position":1},"title":"Pirating Web Content Responsibly With R","author":"hrbrmstr","date":"2017-09-19","format":false,"excerpt":"International Code Talk Like A Pirate Day almost slipped by without me noticing (September has been a crazy busy month), but it popped up in the calendar notifications today and I was glad that I had prepped the meat of a post a few weeks back. There will be no\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":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/09\/Plot_Zoom-2.png?fit=1200%2C917&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/09\/Plot_Zoom-2.png?fit=1200%2C917&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/09\/Plot_Zoom-2.png?fit=1200%2C917&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/09\/Plot_Zoom-2.png?fit=1200%2C917&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/09\/Plot_Zoom-2.png?fit=1200%2C917&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":11540,"url":"https:\/\/rud.is\/b\/2018\/09\/19\/taking-a-tour-of-the-pirate-ship-github-dmca-with-r\/","url_meta":{"origin":3679,"position":2},"title":"Taking a Tour of the Pirate Ship &#8216;GitHub DMCA&#8217; with R","author":"hrbrmstr","date":"2018-09-19","format":false,"excerpt":"Despite having sailed through the core components of this year's Talk Like A Pirate Day R post a few months ago, time has been an enemy of late so this will be a short post that others can build off of, especially since there's lots more knife work ground to\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":7020,"url":"https:\/\/rud.is\/b\/2017\/11\/06\/taking-a-shot-at-cdcfluview-v0-7-0-a-k-a-the-dangers-of-relying-on-hidden-apis\/","url_meta":{"origin":3679,"position":3},"title":"Taking a Shot at cdcfluview v0.7.0 (a.k.a. The Dangers of Relying on &#8216;Hidden&#8217; APIs)","author":"hrbrmstr","date":"2017-11-06","format":false,"excerpt":"Unlike @noamross, I am not an epidemiologist (NOTE: Noam battles pandemics before breakfast, so be super nice to him) but I do like to find kindred methodologies in other disciplines to help foster the growth of cybersecurity into something beyond it's current Barnum & Bailey state. I also love finding\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\/2017\/11\/unnamed-chunk-5-4.png?fit=672%2C480&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/11\/unnamed-chunk-5-4.png?fit=672%2C480&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/11\/unnamed-chunk-5-4.png?fit=672%2C480&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":3314,"url":"https:\/\/rud.is\/b\/2015\/03\/15\/simple-lower-us-48-albers-maps-local-no-api-citystate-geocoding-in-r\/","url_meta":{"origin":3679,"position":4},"title":"Simple Lower US 48 Albers Maps &#038; Local (no-API) City\/State Geocoding in R","author":"hrbrmstr","date":"2015-03-15","format":false,"excerpt":"I've been seeing an uptick in static US \"lower 48\" maps with \"meh\" projections this year, possibly caused by a flood of new folks resolving to learn R but using pretty old documentation or tutorials. I've also been seeing an uptick in folks needing to geocode US city\/state to lat\/lon.\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":4217,"url":"https:\/\/rud.is\/b\/2016\/03\/29\/easier-composite-u-s-choropleths-with-albersusa\/","url_meta":{"origin":3679,"position":5},"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":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/3679","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=3679"}],"version-history":[{"count":0,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/3679\/revisions"}],"wp:attachment":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/media?parent=3679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/categories?post=3679"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/tags?post=3679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}