<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/unhcr-refugee-data-visualized/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://eugejjoh.wordpress.com/2017/02/02/unhcr-refugee-data-visualized/"> R – Incidental Ideas</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>I was working on to expand the disease transmission model from my <a target="_blank" rel="nofollow" href="https://eugejjoh.wordpress.com/2017/01/04/sir-model-with-desolve-ggplot2/">first post</a> but with the currents events, I felt compelled to work on something different. The new United States presidential administration formulated an <a target="_blank" rel="nofollow" href="https://www.nytimes.com/interactive/2017/01/25/us/politics/document-Trump-EO-Draft-on-Refugees.html">executive order</a> the end of last week, if issued, will suspend visas of internationals in the United States (either for school or work) from select countries, prevent the the entrance of Syrian refugees indefinitely and a “readjustment” of the the Refugee and Immigration Programs. Because of this disruptive change in immigration – especially for the most vulnerable populations that include refugees, asylum seekers and displaced people, all fleeing from conflict, instability or persecution – I wanted create a post on this topic.</p>
<h2>Where’s the Data?</h2>
<p>The <a target="_blank" rel="nofollow" href="http://popstats.unhcr.org/en/overview">data</a> I’m using is taken from the <a target="_blank" rel="nofollow" href="http://www.unhcr.org/en-us">United Nations High Commissioner for Refugees</a> (UNHCR) website – the UN Refugee Agency. You can read more on what they do and why the exist in the link above.  <del>Currently you can only download the mid-year statistics for 2015. You get a statement saying: <em>“Error: Statistics filters are not available at this time. Please try again later.” </em></del> I just checked again and the data is accessible again!</p>
<p>In this post I am not going to share my views on the current political landscape in the United States (that can be a complete separate blog on its own). Similar to my <a target="_blank" rel="nofollow" href="https://eugejjoh.wordpress.com/2017/01/24/descriptive-analysis-of-mlst-data-for-mrsa/">previous post</a>, I’m going to do a walkthrough with data cleaning, ask a couple questions and visualize the data in some meaningful way. <strong>If you want to skip the details on the code, you can just scroll down to figures.</strong></p>
<h2>Working in R</h2>
<p>As usual, all the code is in my <a target="_blank" rel="nofollow" href="https://github.com/eugejoh/Mapping_Refugees/blob/master/UNHCR_Refugees.R">GitHub repository</a> for whoever wants to download and use it for themselves. For this post, I’m going to use the following packages ggplot, grid, scales, reshape2, scales and worldcloud. I was reading some R manuals and I discovered a “new” way to access your working directory environment. It involves the use of the <a target="_blank" rel="nofollow" href="https://stat.ethz.ch/R-manual/R-devel/library/base/html/list.files.html">list.files()</a> function, which lists the files or folders in your current working directory. You can also further specify the path name (which saves the time of constantly changing the pathname in the setwd() function (which I have been foolishly doing for a while).</p>
<pre>
setwd(&quot;~/Documents/UNHCR Data/&quot;) # ~ acts as base for home directory

list.files(full.names=TRUE) # gives full path for files or folders
files.all &amp;amp;lt;- list.files(path=&quot;All_Data/&quot;) #assigns name to file names in the All_Data folder
length(files.all) #checks how many objects there are in the /All_Data folder
files.all
</pre>
<p>Since the file is a comm delimited file (.csv) we use the read.csv() function to read it in and assign it the name “ref.d”. I used what I know with the <a target="_blank" rel="nofollow" href="https://stat.ethz.ch/R-manual/R-devel/library/base/html/paste.html">paste0()</a> function  We set the skip argument equal to 2 because by visual inspection of the file, the first two rows are committed to the file title (we don’t want to read that into R). I also used the na.string argument to specify that any blanks (“”), dashes (“-“) and asterisks (“*”) would be considered missing data, NA. The asterisks are specified to be redacted information, based on the <a target="_blank" rel="nofollow" href="http://popstats.unhcr.org/en/overview">UNHCR website</a>.</p>
<pre>
ref.d &amp;amp;lt;- read.csv(paste0(&quot;All_Data/&quot;,files.all), #insert filepath and name into 1st argument
	header=T, #select the headers in 3rd row
	skip=2, #skips the first rows (metadata in .csv file)
	na.string=c(&quot;&quot;,&quot;-&quot;,&quot;*&quot;), #convert all blanks, &quot;i&quot;,&quot;*&quot; cells into missing type NA
	col.names=new.names #since we already made new names
	)
</pre>
<p>First thing I see, the names for the columns names are long and they would be annoying to reproduce. So first we’ll change these using the names() function.</p>
<pre>
new.names &amp;amp;lt;- c(&quot;Year&quot;, &quot;Country&quot;, &quot;Country_Origin&quot;, &quot;Refugees&quot;, &quot;Asylum_Seekers&quot;, &quot;Returned_Refugees&quot;, &quot;IDPs&quot;, &quot;Returned_IDPs&quot;, &quot;Stateless_People&quot;, &quot;Others_of_Concern&quot;,&quot;Total&quot;)
names(ref.d) &amp;amp;lt;- new.names </pre>
<p>By using summary() and str() on the dataset we can see that the range of the data spans from 1951 to 2014, it contains information on the country where refugees are situated, their country of origin, counts for each population of concern and total counts.</p>
<pre> &amp;amp;gt; summary(ref.d)
      Year        Country          Country_Origin        Refugees
 Min.   :1951   Length:103746      Length:103746      Min.   :      1
 1st Qu.:2000   Class :character   Class :character   1st Qu.:      3
 Median :2006   Mode  :character   Mode  :character   Median :     16
 Mean   :2004                                         Mean   :   5992
 3rd Qu.:2010                                         3rd Qu.:    167
 Max.   :2014                                         Max.   :3272290
                                                      NA's   :19353
 Asylum_Seekers     Returned_Refugees      IDPs         Returned_IDPs
 Min.   :     0.0   Min.   :      1   Min.   :    470   Min.   :     23
 1st Qu.:     1.0   1st Qu.:      2   1st Qu.:  90746   1st Qu.:   5000
 Median :     5.0   Median :     16   Median : 261704   Median :  27284
 Mean   :   255.9   Mean   :   6737   Mean   : 540579   Mean   : 111224
 3rd Qu.:    34.0   3rd Qu.:    247   3rd Qu.: 594443   3rd Qu.: 104230
 Max.   :358056.0   Max.   :9799410   Max.   :7632500   Max.   :1186889
 NA's   :46690      NA's   :97327     NA's   :103330    NA's   :103544
 Stateless_People  Others_of_Concern      Total
 Min.   :      1   Min.   :     1.0   Min.   :      1
 1st Qu.:    205   1st Qu.:    14.8   1st Qu.:      3
 Median :   1720   Median :   444.5   Median :     16
 Mean   :  66803   Mean   : 24672.5   Mean   :   8605
 3rd Qu.:  11462   3rd Qu.:  6000.0   3rd Qu.:    166
 Max.   :3500000   Max.   :957000.0   Max.   :9799410
 NA's   :103103    NA's   :103018     NA's   :2433
</pre>
<p>It’s always good practice to identify missing data as well (especially when we set the condition of the read.csv argument above). For non-numeric variables you can use a simple function using apply() and is.na() to identify missing values (NA’s) in your data.</p>
<pre>
apply(ref.d,2, function(x) sum(is.na(x))) </pre>
<p>When I used str() on the data, I saw that the country names were as factors and the populations of concern categories were integers. I made a short for loop to change these to a character and numeric type respectively.</p>
<pre>
for(i in 2:length(names(ref.d))){ # &quot;2&quot;-ignores the first column (we want to keep Year as an integer)
	if (class(ref.d[,i])==&quot;factor&quot;){
		ref.d[,i] &amp;amp;lt;- as.character(ref.d[,i])}
	if (class(ref.d[,i])==&quot;integer&quot;){
		ref.d[,i] &amp;amp;lt;- as.numeric(ref.d[,i])}
}
</pre>
<p>Also another nuance, I wanted to change some of the names of the countries (they were either very long or had extra information). I first identified the names I wanted to change and then replace them a new set of names. I did this using a for loop as well.</p>
<pre>
old.countries &amp;amp;lt;- c(&quot;Bolivia (Plurinational State of)&quot;,
	&quot;China, Hong Kong SAR&quot;,
	&quot;China, Macao SAR&quot;,
	&quot;Iran (Islamic Rep. of)&quot;,
	&quot;Micronesia (Federated States of)&quot;,
	&quot;Serbia and Kosovo (S/RES/1244 (1999))&quot;,
	&quot;Venezuela (Bolivarian Republic of)&quot;,
	&quot;Various/Unknown&quot;)
# replacement names
new.countries &amp;amp;lt;- c(&quot;Bolivia&quot;,&quot;Hong Kong&quot;,&quot;Macao&quot;,&quot;Iran&quot;,&quot;Micronesia&quot;,&quot;Serbia &amp;amp;amp; Kosovo&quot;,&quot;Venezuela&quot;,&quot;Unknown&quot;)
for (k in 1:length(old.countries)){
	ref.d$Country_Origin[ref.d$Country_Origin==old.countries[k]]&amp;amp;lt;-new.countries[k]
	ref.d$Country[ref.d$Country==old.countries[k]]&amp;amp;lt;-new.countries[k]
}
</pre>
<p>If any has alternative ways to achieve the above (ie. using the apply family), comment below! Just a short disclaimer on for loops in R. There has been a lot of argument on the effectiveness of for loops in R compared to the apply function family. A quick <a target="_blank" rel="nofollow" href="https://www.google.com/search?q=apply+vs+for+loop+in+r&oq=apply+vs+for+loop">Google Search</a> shows many opinions on this issue, based on computing speed/power, simplicity, elegance, etc. <a target="_blank" rel="nofollow" href="http://adv-r.had.co.nz/Functionals.html">Advanced R</a> by Hadley Wickham talks about this and I’ve generally used this as a guideline on whether to use a for loop or an apply function.</p>
<h2>Some Descriptives and North Korea</h2>
<p>Just to get an idea of the data, we can create a list of the countries and countries of origin by using the code similar to identifying countries with certain MRSA strains in my <a target="_blank" rel="nofollow" href="https://eugejjoh.wordpress.com/2017/01/24/descriptive-analysis-of-mlst-data-for-mrsa/">previous post</a>.</p>
<pre>
clist&amp;amp;lt;-sort(unique(ref.d$Country)) #alphabetical
clist
or.clist&amp;amp;lt;-sort(unique(ref.d$Country_Origin)) #alphabetical
or.clist
</pre>
<p>We can then compare them for any differences either using matching operators or the setdiff() function. First we’ll do this…</p>
<pre>
clist[!clist %in% or.clist] # or
setdiff(clist,or.clist)

[1] &quot;Bonaire&quot;                   &quot;Montserrat&quot;
[3] &quot;Sint Maarten (Dutch part)&quot; &quot;State of Palestine&quot;
</pre>
<p>… we can infer that these countries haven’t produced refugees or there is no data on these countries in the UNHCR database. If we reverse the comparison…</p>
<pre>
or.clist[!or.clist %in% clist] # or
setdiff(or.clist,clist)

 [1] &quot;Andorra&quot;                     &quot;Anguilla&quot;
 [3] &quot;Bermuda&quot;                     &quot;Cook Islands&quot;
 [5] &quot;Dem. People's Rep. of Korea&quot; &quot;Dominica&quot;
 [7] &quot;French Polynesia&quot;            &quot;Gibraltar&quot;
 [9] &quot;Guadeloupe&quot;                  &quot;Holy See (the)&quot;
[11] &quot;Kiribati&quot;                    &quot;Maldives&quot;
[13] &quot;Marshall Islands&quot;            &quot;Martinique&quot;
[15] &quot;New Caledonia&quot;               &quot;Niue&quot;
[17] &quot;Norfolk Island&quot;              &quot;Palestinian&quot;
[19] &quot;Puerto Rico&quot;                 &quot;Samoa&quot;
[21] &quot;San Marino&quot;                  &quot;Sao Tome and Principe&quot;
[23] &quot;Seychelles&quot;                  &quot;Stateless&quot;
[25] &quot;Tibetan&quot;                     &quot;Tuvalu&quot;
[27] &quot;Wallis and Futuna Islands &quot;  &quot;Western Sahara&quot;
</pre>
<p>… we get a list of countries that have only produced refugees (not taken any refugees in) or there is missing data in the UNHCR. I myself being Korean-Canadian I noticed North Korea (the Democratic People’s Republic of Korea) on this list. I wanted to ask the question, <strong>which countries have the largest number of North Korean refugees based on the UNHCR Data? What are the top 10?</strong></p>
<pre>
NK.tot&amp;amp;lt;- aggregate(cbind(Total)~Country,data=NK,FUN=sum)
NK.tot[order(-NK.tot[,2]),][1:10,]
                    Country Total
31           United Kingdom  4808
5                    Canada  2954
10                  Germany  2845
18              Netherlands   487
3                   Belgium   435
23       Russian Federation   357
32 United States of America   346
1                 Australia   318
20                   Norway   262
9                    France   228
</pre>
<p>We find that the <strong>UK </strong>has the <strong>highest number of North Koreans refugees</strong>, followed by <strong>Canada</strong> and <strong>Germany</strong> with similar counts. Learned something new today.</p>
<h2>Word Clouds in R</h2>
<p>If you haven’t guessed based on the packages I loaded in the beginning, a word cloud was inevitable. Making word clouds in R is pretty simple thanks to the <a target="_blank" rel="nofollow" href="https://cran.r-project.org/web/packages/wordcloud/wordcloud.pdf">wordcloud</a> package. Remember that word clouds are an esthetically decent way to <em><strong>qualitatively</strong></em> see your data. There are bunch of pros and cons on using word clouds. Generally this is appropriate if you just want see the general <em>relative</em> frequency of words in your data. Making any quantitative conclusions would be erroneous.</p>
<p>First we’ll aggregate the counts for the country of origin.</p>
<pre>
or.count.tot &amp;amp;lt;- aggregate(cbind(Total)~Country_Origin,data=ref.d,FUN=sum)
or.count.tot
</pre>
<p>Then set color palette using HEX codes (much thanks to <a target="_blank" rel="nofollow" href="http://tools.medialab.sciences-po.fr/iwanthue/">I Want Hue</a>).</p>
<pre>
pal3 &amp;amp;lt;- c(&quot;#274c56&quot;,
&quot;#664c47&quot;,
&quot;#4e5c48&quot;,
&quot;#595668&quot;,
&quot;#395e68&quot;,
&quot;#516964&quot;,
&quot;#6b6454&quot;,
&quot;#58737f&quot;,
&quot;#846b6b&quot;,
&quot;#807288&quot;,
&quot;#758997&quot;,
&quot;#7e9283&quot;,
&quot;#a79486&quot;,
&quot;#aa95a2&quot;,
&quot;#8ba7b4&quot;)
</pre>
<p>Then let’s make a word cloud based on the countries of origin for the populations of concern in the data and save it as a .png file. I’ve commented the code for each line We can see that Afghanistan seems to have the highest relative number and those with unknown countries of origin is second. Other high conflict countries are visible too like DRC, Iraq, Sudan, Syria, Somalia, etc.</p>
<pre>
# COUNTRY OF ORIGIN
png(&quot;wordcloud_count_or.png&quot;,width=600,height=850,res=200)
wordcloud(or.count.tot[,1], #list of words
	or.count.tot[,2], #frequencies for words
	scale=c(3,.5), #scale of size range
	min.freq=100, #minimum frequency
	max.words=100, #maximum number of words show (others dropped)
	family=&quot;Garamond&quot;, font=2, #text edit (The font &quot;face&quot; (1=plain, 2=bold, 3=italic, 4=bold-italic))
	random.order=F, #F-plotted in decreasing frequency
	colors=rev(pal3)) #colours from least to most frequent (reverse order)
dev.off()
</pre>
<h2><img sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px" data-image-description="" data-orig-file="https://i2.wp.com/eugejjoh.files.wordpress.com/2017/02/wordcloud_count_or.png?w=456&amp;ssl=1" data-orig-size="600,850" data-image-title="wordcloud_count_or" class="wp-image-1184" data-comments-opened="1" data-recalc-dims="1" data-attachment-id="1184" data-permalink="https://eugejjoh.wordpress.com/2017/02/02/unhcr-refugee-data-visualized/wordcloud_count_or/" alt="wordcloud_count_or" data-medium-file="https://i2.wp.com/eugejjoh.files.wordpress.com/2017/02/wordcloud_count_or.png?w=456&amp;ssl=1?w=212" data-large-file="https://i2.wp.com/eugejjoh.files.wordpress.com/2017/02/wordcloud_count_or.png?w=456&amp;ssl=1?w=600" 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;}" src="https://i2.wp.com/eugejjoh.files.wordpress.com/2017/02/wordcloud_count_or.png?w=456&ssl=1"></h2>
<h2>Historical Data Visualized</h2>
<p>So in the UNHCR data, it contains information not only on countries but based on the year from 1951 to 2014. I wanted to see the trends over time between each of the populations of concern. There are seven types of populations in the dataset. Their definitions can be found <a target="_blank" rel="nofollow" href="http://popstats.unhcr.org/en/overview">here</a> on the UNHCR website. To visualize the data using <a target="_blank" rel="nofollow" href="http://ggplot2.org/">ggplot2</a>, it’s a good practice to convert the data from wide to long form. The benefits on using long form can be read <a target="_blank" rel="nofollow" href="https://stanford.edu/~ejdemyr/r-tutorials/wide-and-long/">here</a> and <a target="_blank" rel="nofollow" href="http://vita.had.co.nz/papers/tidy-data.html">here</a>. The accomplish this, we’re going to use the <a target="_blank" rel="nofollow" href="https://cran.r-project.org/web/packages/reshape2/index.html">reshape2</a> package and the melt() function. This <a target="_blank" rel="nofollow" href="http://www.cookbook-r.com/Manipulating_data/Converting_data_between_wide_and_long_format/">tutorial</a> is helpful in understanding what’s going on.</p>
<p>I first subset to remove the country, country of origin and total columns.</p>
<pre>
no.count&amp;amp;lt;-(ref.d[c(-2,-3,-11)]) #removes Country, Country of Origin and Total
lno.count&amp;amp;lt;-melt(no.count,id=c(&quot;Year&quot;))
head(lno.count)
  Year variable  value
1 1951 Refugees 180000
2 1951 Refugees 282000
3 1951 Refugees  55000
4 1951 Refugees 168511
5 1951 Refugees  10000
6 1951 Refugees 265000
</pre>
<p>Then I set the ggplot2 theme and the color palette I want to use.</p>
<pre>
blank_t &amp;amp;lt;- theme_minimal()+
  theme(
  panel.border = element_blank(), #removes border
  panel.background = element_rect(fill = &quot;#d0d1cf&quot;,colour=NA),
  panel.grid = element_line(colour = &quot;#ffffff&quot;),
  plot.title=element_text(size=20, face=&quot;bold&quot;,hjust=0,vjust=2), #set the plot title
  plot.subtitle=element_text(size=15,face=c(&quot;bold&quot;,&quot;italic&quot;),hjust=0.01), #set subtitle
  legend.title=element_text(size=10,face=&quot;bold&quot;,vjust=0.5), #specify legend title
  axis.text.x = element_text(size=9,angle = 0, hjust = 0.5,vjust=1,margin=margin(r=10)),
  axis.text.y = element_text(size=10,margin = margin(r=5)),
  legend.background = element_rect(fill=&quot;gray90&quot;, size=.5),
  legend.position=c(0.15,0.65),
  plot.margin=unit(c(t=1,r=1.2,b=1.2,l=1),&quot;cm&quot;)
  )
pal5 &amp;amp;lt;- c(&quot;#B53C26&quot;, #Refugees 7 TOTAL
&quot;#79542D&quot;, #Asylum Seekers
&quot;#DA634D&quot;, #Returned Refugees
&quot;#0B4659&quot;, #IDPs
&quot;#4B8699&quot;, #Returned IDPs
&quot;#D38F47&quot;, #Stateless People
&quot;#09692A&quot;) #Others of Concern
</pre>
<p>Then use <a target="_blank" rel="nofollow" href="http://docs.ggplot2.org/current/geom_bar.html">geom_bar</a> and the fill argument to make the stacked bar graph over time by specifying what titles and axis labels. In the <a target="_blank" rel="nofollow" href="http://docs.ggplot2.org/current/scale_manual.html">scale_fill_manual()</a> I used the <a target="_blank" rel="nofollow" href="https://stat.ethz.ch/R-manual/R-devel/library/base/html/grep.html">gsub()</a> function remove the underscores from the names (I was lazy to rewrite the names out in a vector and assign it to the labels).</p>
<pre>
gg1 &amp;amp;lt;-ggplot(lno.count,aes(Year,value)) +
	geom_bar(aes(fill=variable),stat=&quot;identity&quot;) +
	labs(title=&quot;UNHCR Population Statistics Database&quot;,
	subtitle=&quot;(1951 - 2014)&quot;,
	x=&quot;Year&quot;,y=&quot;Number of People (Millions)&quot;) + blank_t +
	scale_fill_manual(guide_legend(title=&quot;Populations of Concern&quot;),labels=gsub(&quot;*_&quot;,&quot; &quot;,names(ref.d)[c(-1,-2,-3,-11)]),values=pal5)
</pre>
<p>Next while modifying the axes, I wanted to change the scale of the y-axis to shows it as millions versus 6 zeros. I set the labels argument in <a target="_blank" rel="nofollow" href="http://docs.ggplot2.org/current/scale_gradient.html">scale_y_continuous()</a> to a short function that converts it by a factor of 10e-6. The plot is below and you can click on it to see the full-sized version.</p>
<pre>
mil.func gg2&amp;amp;lt;-gg1+
scale_y_continuous(limits=c(0,6e7),
breaks=pretty(0:6e7,n=5),
labels=mil.func,
expand=c(0.025,0)) +
scale_x_continuous(limits=c(1950,2015),
breaks=seq(1950,2015,by=5),
expand=c(0.01,0))
ggsave(plot=gg2,filename=&quot;UNHCR_Totals_Yr.png&quot;, width=9.5, height=5.5, dpi=200)
</pre>
<p><a target="_blank" rel="nofollow" href="https://i0.wp.com/eugejjoh.files.wordpress.com/2017/02/unhcr_totals_yr.png?ssl=1"><img sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" data-image-description="" data-orig-file="https://i0.wp.com/eugejjoh.files.wordpress.com/2017/02/unhcr_totals_yr.png?w=456&amp;ssl=1" data-orig-size="1900,1100" data-image-title="unhcr_totals_yr" data-comments-opened="1" class="wp-image-1237" data-recalc-dims="1" data-attachment-id="1237" data-permalink="https://eugejjoh.wordpress.com/2017/02/02/unhcr-refugee-data-visualized/unhcr_totals_yr/" alt="unhcr_totals_yr" data-medium-file="https://i0.wp.com/eugejjoh.files.wordpress.com/2017/02/unhcr_totals_yr.png?w=456&amp;ssl=1?w=300" data-large-file="https://i0.wp.com/eugejjoh.files.wordpress.com/2017/02/unhcr_totals_yr.png?w=456&amp;ssl=1?w=840" 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;}" src="https://i0.wp.com/eugejjoh.files.wordpress.com/2017/02/unhcr_totals_yr.png?w=456&ssl=1"></a></p>
<p>So based on this, we can see that there has been a large increase of the total populations of concern the past 30 years. Internally Displaced People (IDPs) have also increased dramatically in the past 20 years. Based on the <a target="_blank" rel="nofollow" href="http://www.unhcr.org/en-us/figures-at-a-glance.html">most recent data</a>, the totals are reaching 65.3 million! (that’s above the y-limit in the bar graph)</p>
<h2>Let’s Be Real</h2>
<p><strong>(Not R related)</strong> Based on doing this, I learned that the UK hosts the highest number of North Korean refugees in the world, that Afghanistan has historically produced the largest number of refugees and there is a upward trend (qualitative conclusion) with the total number of displaced people in recent history. Remembering that these vulnerable populations are mostly undocumented so the numbers in this dataset are likely underestimates to the actual numbers of people who fall under the population of concern definition. In the midst of the news and social media firestorm on all the unfortunate events happening in the world, I think it’s easy to dissociate and just live our own lives. I believe that those with access to resources should be generous with how we use them. A simple act of kindness like a Samaritan can go a long way. Some simple steps that I’ve taken were to educate myself on these issues, advocate where I am able, donate financially and engage where I can. There are a plethora of organizations committed to relieving the burden of these populations – one of them I support is the <a target="_blank" rel="nofollow" href="https://www.rescue.org/">International Rescue Committee</a>.</p>
<p>So I hope this post was informative and demonstrates how one can pull some data off the internet, tinker around with R and discover some news things about the world. Any feedback on the code, alternative ways on what I did are always welcome!</p>
<p> </p>
<p> <a target="_blank" rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/eugejjoh.wordpress.com/963/"><img alt="" src="http://feeds.wordpress.com/1.0/comments/eugejjoh.wordpress.com/963/" border="0"></a> <img alt="" src="https://i1.wp.com/pixel.wp.com/b.gif?resize=1%2C1&ssl=1" border="0" data-recalc-dims="1"></p>
<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://eugejjoh.wordpress.com/2017/02/02/unhcr-refugee-data-visualized/"> R – Incidental Ideas</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/search/data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/search/map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/search/animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/search/sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/search/SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/search/git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/search/hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/search/PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/search/time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/search/trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/6VXKEX-U9Wk"></a></div>