{"id":795,"date":"2016-08-21T11:54:30","date_gmt":"2016-08-21T11:54:30","guid":{"rendered":"http:\/\/codata.org\/blog\/?p=795"},"modified":"2016-08-24T09:30:30","modified_gmt":"2016-08-24T09:30:30","slug":"map-showing-distribution-of-codata-workshop","status":"publish","type":"post","link":"https:\/\/codata.org\/blog\/2016\/08\/21\/map-showing-distribution-of-codata-workshop\/","title":{"rendered":"Map Showing #DataTrieste Attendee Distribution"},"content":{"rendered":"<p><em>This post was written by <a href=\"https:\/\/www.linkedin.com\/pub\/shiva-khanal\/16\/661\/875\" target=\"_blank\">Shiva Khanal<\/a>,\u00a0<a href=\"http:\/\/www.forestrynepal.org\/shiva-khanal\" target=\"_blank\">Research Officer with the\u00a0Department of Forest Research and Survey<\/a> in Nepal. \u00a0Shiva was one of the international scholars sponsored by <a href=\"https:\/\/www.earthobservations.org\/index.php\">GEO, the Group on Earth Observations<\/a>\u00a0to attend the <a href=\"http:\/\/indico.ictp.it\/event\/7658\/other-view?view=ictptimetable\">CODATA-RDA School of Research Data Science, hosted at ICTP, near Trieste, Italy<\/a>.<img loading=\"lazy\" decoding=\"async\" class=\"alignright\" src=\"https:\/\/codata.org\/blog\/wp-content\/uploads\/2015\/03\/Shiva_Trimmed.png\" width=\"172\" height=\"224\" \/><\/em><\/p>\n<p><a href=\"http:\/\/The CODATA-RDA Research Data Science Summer School\">The CODATA-RDA Research Data Science Summer Schoo<\/a>l was held at the ICTP, Trieste, Italy<br \/>\nfrom 1st to 12th August 2016. I was one of the candidates who received funding from <a href=\"https:\/\/www.earthobservations.org\/index.php\">GEO, the Group on Earth Observations<\/a> to attend this interesting event.<\/p>\n<p>Looking at the big list of participants from around the world, as a &#8220;Map Enthusiastic Person&#8221; the first thing I was interested in was to visualize their distribution. Interestingly, in the summer school there was a presentation by Andy South (@southmapr) and he included a demonstration of making world maps in R using the tmap package.<a href=\"https:\/\/codata.org\/blog\/wp-content\/uploads\/2016\/08\/page_banner_l.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-797\" src=\"https:\/\/codata.org\/blog\/wp-content\/uploads\/2016\/08\/page_banner_l-300x97.gif\" alt=\"page_banner_l\" width=\"275\" height=\"89\" \/><\/a><\/p>\n<p>I obtained list of participants with their countries in a spreadsheet from Simon Hodson. Took out the countries field and made a map using tmap package in R to show the distribution of participants and instructors in this summer school.<\/p>\n<p><a href=\"https:\/\/codata.org\/blog\/wp-content\/uploads\/2016\/08\/Countries_Represented.png\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-796 alignleft\" src=\"https:\/\/codata.org\/blog\/wp-content\/uploads\/2016\/08\/Countries_Represented-300x180.png\" alt=\"Countries_Represented\" width=\"606\" height=\"364\" srcset=\"https:\/\/codata.org\/blog\/wp-content\/uploads\/2016\/08\/Countries_Represented-300x180.png 300w, https:\/\/codata.org\/blog\/wp-content\/uploads\/2016\/08\/Countries_Represented-768x461.png 768w, https:\/\/codata.org\/blog\/wp-content\/uploads\/2016\/08\/Countries_Represented-1024x614.png 1024w, https:\/\/codata.org\/blog\/wp-content\/uploads\/2016\/08\/Countries_Represented-624x374.png 624w, https:\/\/codata.org\/blog\/wp-content\/uploads\/2016\/08\/Countries_Represented.png 2000w\" sizes=\"auto, (max-width: 606px) 100vw, 606px\" \/><\/a><\/p>\n<p>###########################################<br \/>\n# The R code to reproduce the map follows:<br \/>\n###########################################<br \/>\n#read a vector of countries represented &#8211; 35 in total<br \/>\n# I have saved the list of countries as a csv in my Dropbox and the code below will read it.<br \/>\n# Just found a better option for later use: a Dropbox interface for R (https:\/\/github.com\/karthik\/rdrop2)<br \/>\ndownload.file(&#8220;https:\/\/www.dropbox.com\/s\/56jim5t3gz67vzm\/countries_represented_codata.csv?dl=1&#8221;, &#8220;countries_list.csv&#8221;)<br \/>\ncodata_countries &lt;- read.csv(&#8220;countries_list.csv&#8221;)$country<br \/>\n#install and load tmap package<br \/>\nif (!require(&#8220;tmap&#8221;)) install.packages(&#8220;tmap&#8221;)<br \/>\n#now lets map the countries<br \/>\ndata(World)<br \/>\ncodata_map &lt;- tm_shape(World) +<br \/>\ntm_borders() +<br \/>\ntm_fill(&#8220;grey90&#8243;, aplha= 0.2)+<br \/>\ntm_grid(projection=&#8221;longlat&#8221;, labels.size = .3, lwd=0.5, col=&#8221;lightblue&#8221;) +<br \/>\ntm_shape(World[ World@data$name %in%\u00a0 codata_countries , ]) + tm_fill(&#8220;red&#8221;)+<br \/>\ntm_text(&#8220;name&#8221;, size=&#8221;AREA&#8221;, col = &#8220;black&#8221;)+ #countries label proportional to area, so<br \/>\nsmaller\/no_label for smaller ones!<br \/>\ntm_borders(&#8220;grey20&#8221;) +<br \/>\ntm_layout(&#8220;Countries represented in CODATA-RDA School of Research Data Science, 2016&#8221;,<br \/>\ninner.margins=c(0,0,.1,0), title.size=.9, title.position = c(&#8220;center&#8221;, &#8220;top&#8221;))+<br \/>\ntm_style_natural(bg.color = &#8220;lightskyblue&#8221;)<br \/>\ncodata_map<br \/>\n#save the output map<br \/>\nsave_tmap(codata_map, &#8220;Countries_Represented.png&#8221;, width=2000, height=1200)<br \/>\n###########################################<\/p>\n<p>The nice vignette for tmap package is here: <a href=\"https:\/\/cran.r-project.org\/web\/packages\/tmap\/vignettes\/tmap-nutshell.html\">https:\/\/cran.r-project.org\/web\/packages\/tmap\/vignettes\/tmap-nutshell.html<br \/>\n<\/a>Martijn Tennekes (2016). tmap: Thematic Maps. R package version 1.4-1. https:\/\/CRAN.R-project.org\/package=tmap<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post was written by Shiva Khanal,\u00a0Research Officer with the\u00a0Department of Forest Research and Survey in Nepal. \u00a0Shiva was one of the international scholars sponsored by GEO, the Group on Earth Observations\u00a0to attend the CODATA-RDA School of Research Data Science, hosted at ICTP, near Trieste, Italy. The CODATA-RDA Research Data Science Summer School was held [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-795","post","type-post","status-publish","format-standard","hentry","category-datatrieste"],"_links":{"self":[{"href":"https:\/\/codata.org\/blog\/wp-json\/wp\/v2\/posts\/795","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codata.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codata.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codata.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codata.org\/blog\/wp-json\/wp\/v2\/comments?post=795"}],"version-history":[{"count":5,"href":"https:\/\/codata.org\/blog\/wp-json\/wp\/v2\/posts\/795\/revisions"}],"predecessor-version":[{"id":827,"href":"https:\/\/codata.org\/blog\/wp-json\/wp\/v2\/posts\/795\/revisions\/827"}],"wp:attachment":[{"href":"https:\/\/codata.org\/blog\/wp-json\/wp\/v2\/media?parent=795"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codata.org\/blog\/wp-json\/wp\/v2\/categories?post=795"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codata.org\/blog\/wp-json\/wp\/v2\/tags?post=795"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}