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:

  • The United Nations High Commissioner for Refugees: Populations Figures
    • UNHCR data on displacement at the end of the year.
  • The United Nations High Commissioner for Refugees: Populations Figures Demographics
    • UNHCR data on displacement at the end of the year by age and gender.
  • The United Nations High Commissioner for Refugees: Asylum Applications
    • Asylum claims submitted during the year.
  • The United Nations High Commissioner for Refugees: Asylum Decisions
    • Decisions taken on asylum claims during the year.
  • Internally Displaced Persons
    • Internal displacement due to conflict and violence at the end of the year as reported by the International Displacement Monitoring Center (IDMC).
  • United Nations Relief Works Agency: Palestinian Refugees
    • Registered Palestine refugees at the end of the year.
  • United Nations Department of Economic and Social Affairs Population Division: International Migrant Stocks Time Series (2017 and 2019 Revisions)
    • Official statistics on the foreign-born or the foreign population by host country.

This welcome page presents a brief introduction to the untools package. For more detailed information and reference materials for untools please refer to:

Installation

You can install the released version of untools from GitLab with:

devtools::install_gitlab("dante-sttr/untools", dependencies=TRUE)

Installation With Windows

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.

Usage

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)