{"id":380161,"date":"2023-11-19T15:05:00","date_gmt":"2023-11-19T21:05:00","guid":{"rendered":"https:\/\/r.iresmi.net\/posts\/2023\/5_minutes\/index.html"},"modified":"2023-11-19T15:05:00","modified_gmt":"2023-11-19T21:05:00","slug":"5-minute-map","status":"publish","type":"post","link":"https:\/\/www.r-bloggers.com\/2023\/11\/5-minute-map\/","title":{"rendered":"5-minute map"},"content":{"rendered":"<!-- \r\n<div style=\"min-height: 30px;\">\r\n[social4i size=\"small\" align=\"align-left\"]\r\n<\/div>\r\n-->\r\n\r\n<div style=\"border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 12px;\">\r\n[This article was first published on  <strong><a href=\"https:\/\/r.iresmi.net\/posts\/2023\/5_minutes\/index.html\"> r.iresmi.net<\/a><\/strong>, and kindly contributed to <a href=\"https:\/\/www.r-bloggers.com\/\" rel=\"nofollow\">R-bloggers<\/a>].  (You can report issue about the content on this page <a href=\"https:\/\/www.r-bloggers.com\/contact-us\/\">here<\/a>)\r\n<hr>Want to share your content on R-bloggers?<a href=\"https:\/\/www.r-bloggers.com\/add-your-blog\/\" rel=\"nofollow\"> click here<\/a> if you have a blog, or <a href=\"http:\/\/r-posts.com\/\" rel=\"nofollow\"> here<\/a> if you don't.\r\n<\/div>\n \n\n\n\n\n<div class=\"quarto-figure quarto-figure-center\">\n<figure class=\"figure\">\n<p><a href=\"https:\/\/flic.kr\/p\/uexEy4\" rel=\"nofollow\" target=\"_blank\"><img src=\"https:\/\/i1.wp.com\/r.iresmi.net\/posts\/2023\/5_minutes\/images\/18531282115_0cb47a59bf_c.jpg?w=578&#038;ssl=1\" class=\"img-fluid figure-img\" alt=\"A photo of a clock\" data-recalc-dims=\"1\"><\/a><\/p>\n<figcaption class=\"figure-caption\">Clock 10:05 \u2013 CC-BY-NC-ND by Bill Dickinson<\/figcaption>\n<\/figure>\n<\/div>\n<p>Day\u00a019 of <a href=\"https:\/\/30daymapchallenge.com\/\" rel=\"nofollow\" target=\"_blank\">30DayMapChallenge<\/a>: \u00ab\u00a05-minute map\u00a0\u00bb (<a href=\"https:\/\/r.iresmi.net\/#category=30DayMapChallenge\" rel=\"nofollow\" target=\"_blank\">previously<\/a>).<\/p>\n<section id=\"setup\" class=\"level2\">\n<h2 class=\"anchored\" data-anchor-id=\"setup\">Setup<\/h2>\n<div class=\"cell\">\n<pre>library(tidyverse)\nlibrary(leaflet)\nlibrary(httr)\nlibrary(fs)\nlibrary(glue)<\/pre>\n<\/div>\n<\/section>\n<section id=\"data\" class=\"level2\">\n<h2 class=\"anchored\" data-anchor-id=\"data\">Data<\/h2>\n<p>We reuse the Geonames data from <a href=\"https:\/\/r.iresmi.net\/posts\/2023\/bad_map\/\" rel=\"nofollow\" target=\"_blank\">Bad map<\/a>.<\/p>\n<div class=\"cell\">\n<pre>gn_file &lt;- &quot;~\/data\/geonames\/allCountries.zip&quot;\n\nif (!file_exists(gn_file)) {\n  GET(&quot;http:\/\/download.geonames.org\/export\/dump\/allCountries.zip&quot;,\n      write_disk(gn_file))\n}\n\ngn &lt;- read_delim(\n  gn_file, \n  delim = &quot;\\t&quot;, \n  col_names = c(&quot;geonameid&quot;,     \n                &quot;name&quot;,          \n                &quot;asciiname&quot;,     \n                &quot;alternatenames&quot;,\n                &quot;latitude&quot;,      \n                &quot;longitude&quot;,     \n                &quot;feature_class&quot;, \n                &quot;feature_code&quot;,  \n                &quot;country_code&quot;,  \n                &quot;cc2&quot;,           \n                &quot;admin1_code&quot;,   \n                &quot;admin2_code&quot;,   \n                &quot;admin3_code&quot;,   \n                &quot;admin4_code&quot;,   \n                &quot;population&quot;,    \n                &quot;elevation&quot;,     \n                &quot;dem&quot;,           \n                &quot;timezone&quot;,      \n                &quot;modification_date&quot;))<\/pre>\n<\/div>\n<p>We randomly keep five places containing \u201cminute\u201d\u2026<\/p>\n<div class=\"cell\">\n<pre>set.seed(314)\n\nminute &lt;- gn |&gt; \n  filter(str_detect(asciiname, &quot;\\\\b[Mm]inute\\\\b&quot;)) |&gt; \n  slice_sample(n = 5)<\/pre>\n<\/div>\n<\/section>\n<section id=\"map\" class=\"level2\">\n<h2 class=\"anchored\" data-anchor-id=\"map\">Map<\/h2>\n<div class=\"cell\">\n<pre>minute |&gt; \n  leaflet() |&gt; \n  addCircleMarkers(popup = ~ glue(&quot;{name} ({asciiname})&lt;br \/&gt;\n                                  &lt;b&gt;{country_code}&lt;\/b&gt;&quot;),\n                   label = ~ asciiname,\n                   labelOptions = labelOptions(noHide = TRUE)) |&gt; \n  addTiles(attribution = &quot;Geonames and \u00a9 OpenStreetMap, ODbL&quot;)<\/pre>\n<div id=\"fig-map\" class=\"quarto-figure quarto-figure-center anchored\">\n<figure class=\"figure\">\n<div class=\"leaflet html-widget html-fill-item-overflow-hidden html-fill-item\" id=\"htmlwidget-a601f53e6b9f0cc54b27\" style=\"width:100%;height:464px;\"><\/div>\n<script type=\"application\/json\" data-for=\"htmlwidget-a601f53e6b9f0cc54b27\">{\"x\":{\"options\":{\"crs\":{\"crsClass\":\"L.CRS.EPSG3857\",\"code\":null,\"proj4def\":null,\"projectedBounds\":null,\"options\":{}}},\"calls\":[{\"method\":\"addCircleMarkers\",\"args\":[[45.96676,43.88568,50.76222,37.89736,44.72954],[-83.13318,-122.10893,-67.01917,-79.05364,-110.70309],10,null,null,{\"interactive\":true,\"className\":\"\",\"stroke\":true,\"color\":\"#03F\",\"weight\":5,\"opacity\":0.5,\"fill\":true,\"fillColor\":\"#03F\",\"fillOpacity\":0.2},null,null,[\"Twenty Minute Point (Twenty Minute Point)<br \/>\\n<b>CA<\\\/b>\",\"Minute Creek (Minute Creek)<br \/>\\n<b>US<\\\/b>\",\"Lac de la Minute (Lac de la Minute)<br \/>\\n<b>CA<\\\/b>\",\"Twenty Minute Cliff Overlook (Twenty Minute Cliff Overlook)<br \/>\\n<b>US<\\\/b>\",\"Minute Geyser (Minute Geyser)<br \/>\\n<b>US<\\\/b>\"],null,[\"Twenty Minute Point\",\"Minute Creek\",\"Lac de la Minute\",\"Twenty Minute Cliff Overlook\",\"Minute Geyser\"],{\"interactive\":false,\"permanent\":true,\"direction\":\"auto\",\"opacity\":1,\"offset\":[0,0],\"textsize\":\"10px\",\"textOnly\":false,\"className\":\"\",\"sticky\":true},null]},{\"method\":\"addTiles\",\"args\":[\"https:\/\/{s}.tile.openstreetmap.org\/{z}\/{x}\/{y}.png\",null,null,{\"minZoom\":0,\"maxZoom\":18,\"tileSize\":256,\"subdomains\":\"abc\",\"errorTileUrl\":\"\",\"tms\":false,\"noWrap\":false,\"zoomOffset\":0,\"zoomReverse\":false,\"opacity\":1,\"zIndex\":1,\"detectRetina\":false,\"attribution\":\"Geonames and \u00a9 OpenStreetMap, ODbL\"}]}],\"limits\":{\"lat\":[37.89736,50.76222],\"lng\":[-122.10893,-67.01917]}},\"evals\":[],\"jsHooks\":[]}<\/script>\n<figcaption class=\"figure-caption\">Figure\u00a01: \u2026 and here is the Five minute map<\/figcaption>\n<\/figure>\n<\/div>\n<\/div>\n\n\n<!-- -->\n\n<\/section>\n\n \n<div style=\"border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 13px;\">\r\n<div style=\"text-align: center;\">To <strong>leave a comment<\/strong> for the author, please follow the link and comment on their blog: <strong><a href=\"https:\/\/r.iresmi.net\/posts\/2023\/5_minutes\/index.html\"> r.iresmi.net<\/a><\/strong>.<\/div>\r\n<hr \/>\r\n<a href=\"https:\/\/www.r-bloggers.com\/\" rel=\"nofollow\">R-bloggers.com<\/a> offers <strong><a href=\"https:\/\/feedburner.google.com\/fb\/a\/mailverify?uri=RBloggers\" rel=\"nofollow\">daily e-mail updates<\/a><\/strong> about <a title=\"The R Project for Statistical Computing\" href=\"https:\/\/www.r-project.org\/\" rel=\"nofollow\">R<\/a> news and tutorials about <a title=\"R tutorials\" href=\"https:\/\/www.r-bloggers.com\/how-to-learn-r-2\/\" rel=\"nofollow\">learning R<\/a> and many other topics. <a title=\"Data science jobs\" href=\"https:\/\/www.r-users.com\/\" rel=\"nofollow\">Click here if you're looking to post or find an R\/data-science job<\/a>.\r\n\r\n<hr>Want to share your content on R-bloggers?<a href=\"https:\/\/www.r-bloggers.com\/add-your-blog\/\" rel=\"nofollow\"> click here<\/a> if you have a blog, or <a href=\"http:\/\/r-posts.com\/\" rel=\"nofollow\"> here<\/a> if you don't.\r\n<\/div>","protected":false},"excerpt":{"rendered":"<div style = \"width:60%; display: inline-block; float:left; \">\n<p>Clock 10:05 \u2013 CC-BY-NC-ND by Bill Dickinson<\/p>\n<p>Day\u00a019 of 30DayMapChallenge: \u00ab\u00a05-minute map\u00a0\u00bb (previously).<\/p>\n<p>Setup<\/p>\n<p>library(tidyverse)<br \/>\nlibrary(leaflet)<br \/>\nlibrary(httr)<br \/>\nlibrary(fs)<br \/>\nlibrary(glue)<\/p>\n<p>Data<br \/>\nWe reuse the Geonames data from Bad map.<\/p>\n<p>gn_file<br \/>\n  slice_sample(n = 5)<\/p>\n<p>Map<\/p>\n<p>minute |__<br \/>\n  leaflet() |__<br \/>\n  addCircleMarkers(popup = ~ glue(&#8220;{name} ({asciiname})<br \/>\n                                  {country_code}&#8221;),<br \/>\n                   label = ~ asciiname,<br \/>\n                   labelOptions = labelOptions(&#8230;<\/p><\/div>\n<div style = \"width: 40%; display: inline-block; float:right;\"><\/div>\n<div style=\"clear: both;\"><\/div>\n","protected":false},"author":80,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"aioseo_notices":[],"jetpack-related-posts":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/posts\/380161"}],"collection":[{"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/users\/80"}],"replies":[{"embeddable":true,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/comments?post=380161"}],"version-history":[{"count":2,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/posts\/380161\/revisions"}],"predecessor-version":[{"id":380171,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/posts\/380161\/revisions\/380171"}],"wp:attachment":[{"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/media?parent=380161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/categories?post=380161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/tags?post=380161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}