The untools
package provides a suite of tools to facilitate acquiring, processing, and visualizing United Nations data. We currently provide support, in at least some capacity, for the following United Nations data sets:
This welcome page presents a brief introduction to the untools
package. For more detailed information and reference materials for untools
please refer to:
You can install the released version of untools from GitLab with:
devtools::install_gitlab("dante-sttr/untools", dependencies=TRUE)
To install R packages over Git on a Windows system, you must install Rtools first. The latest version of Rtools is available here. Furthermore, you may experience difficulty installing R packages over Git if you utilize a Windows machine on a network with Active Directory or shared network drives. To enable proper package installation under these circumstances please follow this guide.
Read in the United Nations Migrant Stock (2019 Revision) data with the getUNstocks
function. This function will automatically parse the spreadsheet and provide simple formatting and processing.
library(untools)
stocks19<-untools::getUNstocks(version = '2019')
#> Warning in `[.data.table`(stocks, , `:=`(id, NULL)): Column 'id' does not exist
#> to remove
year |
host |
host_iso3 |
origin |
origin_iso3 |
stock |
code |
---|---|---|---|---|---|---|
2019 |
Argentina |
ARG |
Afghanistan |
AFG |
9 |
32 |
2015 |
Argentina |
ARG |
Afghanistan |
AFG |
9 |
32 |
2010 |
Argentina |
ARG |
Afghanistan |
AFG |
9 |
32 |
2005 |
Argentina |
ARG |
Afghanistan |
AFG |
15 |
32 |
2000 |
Argentina |
ARG |
Afghanistan |
AFG |
20 |
32 |
1995 |
Argentina |
ARG |
Afghanistan |
AFG |
20 |
32 |
1990 |
Argentina |
ARG |
Afghanistan |
AFG |
20 |
32 |
2019 |
Australia |
AUS |
Afghanistan |
AFG |
59798 |
36 |
2015 |
Australia |
AUS |
Afghanistan |
AFG |
49550 |
36 |
2010 |
Australia |
AUS |
Afghanistan |
AFG |
30840 |
36 |
Plot a time series of the top migrant stock populations in the United States using the ISO3 character code.
usa.stocks.ts<-plot(stocks19, country = "USA")
Or view a barplot of only the year 2000.
usa.stocks.static<-plot(stocks19, country = "USA", mode = 'static', yr=2005)