Last updated: 2020-08-24

Checks: 7 0

Knit directory: GeoPKO/

This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20200629) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 611e458. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/

Untracked files:
    Untracked:  2020_07_21.R
    Untracked:  figure/viz.Rmd/

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/index.Rmd) and HTML (docs/index.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd 611e458 Nguyen Ha 2020-08-24 new build
Rmd 2e94be5 Lou van Roozendaal 2020-08-20 update Lou
Rmd 2d92eca Lou van Roozendaal 2020-08-17 packages
Rmd 6538fb8 Lou van Roozendaal 2020-08-17 troop count
html 658018a Nguyen Ha 2020-08-17 Build site.
Rmd b846f76 Nguyen Ha 2020-08-17 adding Lou’s update
Rmd c70e8b0 Lou van Roozendaal 2020-08-14 descriptivstatistics
html 7447d5c Nguyen Ha 2020-08-13 Build site.
Rmd 03c6897 Nguyen Ha 2020-08-13 wflow_publish(all = TRUE)
html 9a57942 Nguyen Ha 2020-08-13 Build site.
Rmd 3c3a981 Nguyen Ha 2020-08-13 Updating new maps, new pages
Rmd 7cb84d7 Tanushree Rao 2020-08-10 updating map
html e72567f Nguyen Ha 2020-07-10 Build site.
Rmd 9ec337b Nguyen Ha 2020-07-10 Update
Rmd 92d111c Nguyen Ha 2020-07-10 Pulling before compiling. Merge branch ‘master’ of https://github.com/hatnguyen267/GeoPKO into render
Rmd bcabf5e Nguyen Ha 2020-07-10 Pre-pull commit
html bcabf5e Nguyen Ha 2020-07-10 Pre-pull commit
Rmd a35561b Lou van Roozendaal 2020-07-09 added table
html baaaa20 Nguyen Ha 2020-07-08 Build site.
Rmd b3d8755 Nguyen Ha 2020-07-08 Adjusting graph output size
html 884b86f Nguyen Ha 2020-07-08 Build site.
Rmd e863725 Nguyen Ha 2020-07-08 building site with Tanushree’s additions
Rmd 8fe33fc GitHub 2020-07-08 Merge branch ‘master’ into hey
html 325ac4f Nguyen Ha 2020-07-08 Build site.
Rmd f5bc390 Nguyen Ha 2020-07-08 Updating the stupid animated graph hope it will render
html 6bcd405 Nguyen Ha 2020-07-08 Build site.
Rmd 176eca5 Nguyen Ha 2020-07-08 wflow_publish(“analysis/index.Rmd”)
Rmd ebb000d Nguyen Ha 2020-07-08 Animation added to index.rmd, waiting to be rendered
html ebb000d Nguyen Ha 2020-07-08 Animation added to index.rmd, waiting to be rendered
Rmd 5edc140 Tanushree Rao 2020-07-07 new map
html 819ccf2 Nguyen Ha 2020-07-03 Build site.
Rmd 9c0642e Nguyen Ha 2020-07-03 wflow_publish(“analysis/index.Rmd”)
Rmd 0d5cc47 Nguyen Ha 2020-07-03 Fixed conflict with main fol.
Rmd 4cf53c8 Nguyen Ha 2020-07-03 Fixing legend position; previous tables
Rmd 14ab237 GitHub 2020-07-03 Update index.Rmd
Rmd 557ebbf Lou van Roozendaal 2020-07-03 Lou_change_graph
html 3bde5f5 Nguyen Ha 2020-07-02 Build site.
Rmd 8b39fe5 Nguyen Ha 2020-07-02 wflow_publish(c(“index.Rmd”, “about.Rmd”))
html 8b39fe5 Nguyen Ha 2020-07-02 wflow_publish(c(“index.Rmd”, “about.Rmd”))
html 01d2b98 hatnguyen267 2020-06-29 Build site.
Rmd 0a3c9c9 hatnguyen267 2020-06-29 more to index.rmb
html 50d7b31 hatnguyen267 2020-06-29 Build site.
Rmd 4db5b4f hatnguyen267 2020-06-29 adding items to index.rmb
html 4d2d90f hatnguyen267 2020-06-29 Build site.
Rmd a7817f7 hatnguyen267 2020-06-29 wflow_publish(all = TRUE)
Rmd 8e7fc45 hatnguyen267 2020-06-29 Start workflowr project.

This document contains a series of steps that the project members have performed to extract meaningful information the Geo-PKO dataset. More details on the dataset, as well as the version used here, can be found on its homepage. Note that the current version of this report is produced using version 1.2.

Setting up

Load packages.

library(tidyverse)
library(readr)
library(ggthemes)
library(knitr)
library(kableExtra)
library(lubridate)
library(tidyr)
library(dplyr)

We start by importing the dataset. To get a sense of how read_csv would parse the dataset, run spec_csv() on the dataset beforehand.

specs <- spec_csv("data/geopko.csv")
Parsed with column specification:
cols(
  .default = col_double(),
  Source = col_character(),
  Mission = col_character(),
  location = col_character(),
  country = col_character(),
  No.troops = col_character(),
  RPF = col_logical(),
  RPF_No = col_logical(),
  No.TCC = col_character(),
  name.of.TCC1 = col_character(),
  No.troops.per.TCC1 = col_character(),
  name.of.TCC2 = col_character(),
  No.troops.per.TCC2 = col_character(),
  name.of.TCC3 = col_character(),
  name.of.TCC4 = col_character(),
  name.of.TCC5 = col_character(),
  name.of.TCC6 = col_character(),
  name.of.TCC7 = col_character(),
  name.of.TCC8 = col_character(),
  name.of.TCC9 = col_character(),
  name.of.TCC10 = col_logical()
  # ... with 18 more columns
)
See spec(...) for full column specifications.

This shows that R might arbitrarily parse our columns as logical, which may mess up the data. Here, we are going to dodge this issue by telling R to parse all columns as character.

GeoPKO <- read_csv("data/geopko.csv",  
                   col_types = cols(.default="c"))

An overview

Let’s have a quick look at the dataset.

str(GeoPKO)
tibble [12,190 x 71] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
 $ Source             : chr [1:12190] "Map no. 4309" "Map no. 4309 Rev. 1" "Map no. 4203 Rev. 2" "Map no. 4203 Rev. 3" ...
 $ Mission            : chr [1:12190] "BINUB" "BINUB" "MINUCI" "MINUCI" ...
 $ year               : chr [1:12190] "2007" "2009" "2003" "2003" ...
 $ month              : chr [1:12190] "3" "8" "8" "11" ...
 $ location           : chr [1:12190] "Bujumbura" "Bujumbura" "Abidjan" "Abidjan" ...
 $ country            : chr [1:12190] "Burundi" "Burundi" "Ivory Coast" "Ivory Coast" ...
 $ latitude           : chr [1:12190] "-3.3822" "-3.3822" "5.309657" "5.309657" ...
 $ longitude          : chr [1:12190] "29.3644" "29.3644" "-4.012656" "-4.012656" ...
 $ No.troops          : chr [1:12190] "0" "0" "0" "0" ...
 $ RPF                : chr [1:12190] NA NA NA NA ...
 $ RPF_No             : chr [1:12190] NA NA NA NA ...
 $ RES                : chr [1:12190] "0" "0" "0" "0" ...
 $ RES_No             : chr [1:12190] "0" "0" "0" "0" ...
 $ FP                 : chr [1:12190] "0" "0" "0" "0" ...
 $ FP_No              : chr [1:12190] "0" "0" "0" "0" ...
 $ No.TCC             : chr [1:12190] "0" "0" "0" "0" ...
 $ name.of.TCC1       : chr [1:12190] NA NA NA NA ...
 $ No.troops.per.TCC1 : chr [1:12190] NA NA NA NA ...
 $ name.of.TCC2       : chr [1:12190] NA NA NA NA ...
 $ No.troops.per.TCC2 : chr [1:12190] NA NA NA NA ...
 $ name.of.TCC3       : chr [1:12190] NA NA NA NA ...
 $ No.troops.per.TCC3 : chr [1:12190] NA NA NA NA ...
 $ name.of.TCC4       : chr [1:12190] NA NA NA NA ...
 $ No.troops.per.TCC4 : chr [1:12190] NA NA NA NA ...
 $ name.of.TCC5       : chr [1:12190] NA NA NA NA ...
 $ No.troops.per.TCC5 : chr [1:12190] NA NA NA NA ...
 $ name.of.TCC6       : chr [1:12190] NA NA NA NA ...
 $ No.troops.per.TCC6 : chr [1:12190] NA NA NA NA ...
 $ name.of.TCC7       : chr [1:12190] NA NA NA NA ...
 $ No.troops.per.TCC7 : chr [1:12190] NA NA NA NA ...
 $ name.of.TCC8       : chr [1:12190] NA NA NA NA ...
 $ No.troops.per.TCC8 : chr [1:12190] NA NA NA NA ...
 $ name.of.TCC9       : chr [1:12190] NA NA NA NA ...
 $ No.troops.per.TCC9 : chr [1:12190] NA NA NA NA ...
 $ name.of.TCC10      : chr [1:12190] NA NA NA NA ...
 $ No.troops.per.TCC10: chr [1:12190] NA NA NA NA ...
 $ name.of.TCC11      : chr [1:12190] NA NA NA NA ...
 $ No.troops.per.TCC11: chr [1:12190] NA NA NA NA ...
 $ name.of.TCC12      : chr [1:12190] NA NA NA NA ...
 $ No.troops.per.TCC12: chr [1:12190] NA NA NA NA ...
 $ name.of.TCC13      : chr [1:12190] NA NA NA NA ...
 $ No.troops.per.TCC13: chr [1:12190] NA NA NA NA ...
 $ name.of.TCC14      : chr [1:12190] NA NA NA NA ...
 $ No.troops.per.TCC14: chr [1:12190] NA NA NA NA ...
 $ UNPOL..dummy.      : chr [1:12190] "0" "0" "0" "0" ...
 $ UNMO..dummy.       : chr [1:12190] "0" "0" "0" "0" ...
 $ HQ                 : chr [1:12190] "3" "3" "3" "3" ...
 $ LO                 : chr [1:12190] "0" "0" "0" "0" ...
 $ comments           : chr [1:12190] NA NA "MINUCI HQ; Also ECOWAS main HQ; France HQ" "MINUCI HQ; Also ECOWAS main HQ; France HQ; Fanci HQ" ...
 $ cow_code           : chr [1:12190] "516" "516" "437" "437" ...
 $ gwno               : chr [1:12190] "516" "516" "437" "437" ...
 $ name               : chr [1:12190] "Burundi" "Burundi" "Cote D’Ivoire" "Cote D’Ivoire" ...
 $ TCC1               : chr [1:12190] NA NA NA NA ...
 $ TCC2               : chr [1:12190] NA NA NA NA ...
 $ TCC3               : chr [1:12190] NA NA NA NA ...
 $ TCC4               : chr [1:12190] NA NA NA NA ...
 $ TCC5               : chr [1:12190] NA NA NA NA ...
 $ TCC6               : chr [1:12190] NA NA NA NA ...
 $ TCC7               : chr [1:12190] NA NA NA NA ...
 $ TCC8               : chr [1:12190] NA NA NA NA ...
 $ TCC9               : chr [1:12190] NA NA NA NA ...
 $ TCC10              : chr [1:12190] NA NA NA NA ...
 $ TCC11              : chr [1:12190] NA NA NA NA ...
 $ TCC12              : chr [1:12190] NA NA NA NA ...
 $ TCC13              : chr [1:12190] NA NA NA NA ...
 $ TCC14              : chr [1:12190] NA NA NA NA ...
 $ ADM1_id            : chr [1:12190] "3348" "3348" "3411" "3411" ...
 $ ADM1_name          : chr [1:12190] "Bujumbura Mairie" "Bujumbura Mairie" "Lagunes" "Lagunes" ...
 $ ADM2_id            : chr [1:12190] "20147" "20147" "40389" "40389" ...
 $ ADM2_name          : chr [1:12190] "Roherero" "Roherero" "Abidjan" "Abidjan" ...
 $ PRIOID             : chr [1:12190] "124979" "124979" "137152" "137152" ...
 - attr(*, "spec")=
  .. cols(
  ..   .default = col_character(),
  ..   Source = col_character(),
  ..   Mission = col_character(),
  ..   year = col_character(),
  ..   month = col_character(),
  ..   location = col_character(),
  ..   country = col_character(),
  ..   latitude = col_character(),
  ..   longitude = col_character(),
  ..   No.troops = col_character(),
  ..   RPF = col_character(),
  ..   RPF_No = col_character(),
  ..   RES = col_character(),
  ..   RES_No = col_character(),
  ..   FP = col_character(),
  ..   FP_No = col_character(),
  ..   No.TCC = col_character(),
  ..   name.of.TCC1 = col_character(),
  ..   No.troops.per.TCC1 = col_character(),
  ..   name.of.TCC2 = col_character(),
  ..   No.troops.per.TCC2 = col_character(),
  ..   name.of.TCC3 = col_character(),
  ..   No.troops.per.TCC3 = col_character(),
  ..   name.of.TCC4 = col_character(),
  ..   No.troops.per.TCC4 = col_character(),
  ..   name.of.TCC5 = col_character(),
  ..   No.troops.per.TCC5 = col_character(),
  ..   name.of.TCC6 = col_character(),
  ..   No.troops.per.TCC6 = col_character(),
  ..   name.of.TCC7 = col_character(),
  ..   No.troops.per.TCC7 = col_character(),
  ..   name.of.TCC8 = col_character(),
  ..   No.troops.per.TCC8 = col_character(),
  ..   name.of.TCC9 = col_character(),
  ..   No.troops.per.TCC9 = col_character(),
  ..   name.of.TCC10 = col_character(),
  ..   No.troops.per.TCC10 = col_character(),
  ..   name.of.TCC11 = col_character(),
  ..   No.troops.per.TCC11 = col_character(),
  ..   name.of.TCC12 = col_character(),
  ..   No.troops.per.TCC12 = col_character(),
  ..   name.of.TCC13 = col_character(),
  ..   No.troops.per.TCC13 = col_character(),
  ..   name.of.TCC14 = col_character(),
  ..   No.troops.per.TCC14 = col_character(),
  ..   UNPOL..dummy. = col_character(),
  ..   UNMO..dummy. = col_character(),
  ..   HQ = col_character(),
  ..   LO = col_character(),
  ..   comments = col_character(),
  ..   cow_code = col_character(),
  ..   gwno = col_character(),
  ..   name = col_character(),
  ..   TCC1 = col_character(),
  ..   TCC2 = col_character(),
  ..   TCC3 = col_character(),
  ..   TCC4 = col_character(),
  ..   TCC5 = col_character(),
  ..   TCC6 = col_character(),
  ..   TCC7 = col_character(),
  ..   TCC8 = col_character(),
  ..   TCC9 = col_character(),
  ..   TCC10 = col_character(),
  ..   TCC11 = col_character(),
  ..   TCC12 = col_character(),
  ..   TCC13 = col_character(),
  ..   TCC14 = col_character(),
  ..   ADM1_id = col_character(),
  ..   ADM1_name = col_character(),
  ..   ADM2_id = col_character(),
  ..   ADM2_name = col_character(),
  ..   PRIOID = col_character()
  .. )
kable(GeoPKO[1:5,]) %>% kable_styling() %>%
  scroll_box(width = "100%", height = "200px") #displaying the first five rows
Source Mission year month location country latitude longitude No.troops RPF RPF_No RES RES_No FP FP_No No.TCC name.of.TCC1 No.troops.per.TCC1 name.of.TCC2 No.troops.per.TCC2 name.of.TCC3 No.troops.per.TCC3 name.of.TCC4 No.troops.per.TCC4 name.of.TCC5 No.troops.per.TCC5 name.of.TCC6 No.troops.per.TCC6 name.of.TCC7 No.troops.per.TCC7 name.of.TCC8 No.troops.per.TCC8 name.of.TCC9 No.troops.per.TCC9 name.of.TCC10 No.troops.per.TCC10 name.of.TCC11 No.troops.per.TCC11 name.of.TCC12 No.troops.per.TCC12 name.of.TCC13 No.troops.per.TCC13 name.of.TCC14 No.troops.per.TCC14 UNPOL..dummy. UNMO..dummy. HQ LO comments cow_code gwno name TCC1 TCC2 TCC3 TCC4 TCC5 TCC6 TCC7 TCC8 TCC9 TCC10 TCC11 TCC12 TCC13 TCC14 ADM1_id ADM1_name ADM2_id ADM2_name PRIOID
Map no. 4309 BINUB 2007 3 Bujumbura Burundi -3.3822 29.3644 0 NA NA 0 0 0 0 0 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0 0 3 0 NA 516 516 Burundi NA NA NA NA NA NA NA NA NA NA NA NA NA NA 3348 Bujumbura Mairie 20147 Roherero 124979
Map no. 4309 Rev. 1 BINUB 2009 8 Bujumbura Burundi -3.3822 29.3644 0 NA NA 0 0 0 0 0 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0 0 3 0 NA 516 516 Burundi NA NA NA NA NA NA NA NA NA NA NA NA NA NA 3348 Bujumbura Mairie 20147 Roherero 124979
Map no. 4203 Rev. 2 MINUCI 2003 8 Abidjan Ivory Coast 5.309657 -4.012656 0 NA NA 0 0 0 0 0 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0 0 3 0 MINUCI HQ; Also ECOWAS main HQ; France HQ 437 437 Cote D’Ivoire NA NA NA NA NA NA NA NA NA NA NA NA NA NA 3411 Lagunes 40389 Abidjan 137152
Map no. 4203 Rev. 3 MINUCI 2003 11 Abidjan Ivory Coast 5.309657 -4.012656 0 NA NA 0 0 0 0 0 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0 0 3 0 MINUCI HQ; Also ECOWAS main HQ; France HQ; Fanci HQ 437 437 Cote D’Ivoire NA NA NA NA NA NA NA NA NA NA NA NA NA NA 3411 Lagunes 40389 Abidjan 137152
Map no. 4203 Rev. 4 MINUCI 2004 1 Abidjan Ivory Coast 5.309657 -4.012656 0 NA NA 0 0 0 0 0 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0 0 3 0 MINUCI HQ; ECOWAS main HQ; France HQ; Fanci HQ 437 437 Cote D’Ivoire NA NA NA NA NA NA NA NA NA NA NA NA NA NA 3411 Lagunes 40389 Abidjan 137152

Whew, this list was kind of long, but this was because the GeoPKO includes 12,190 rows and 73 columns.

What missions are included?

unique(GeoPKO$Mission)
 [1] "BINUB"      "MINUCI"     "MINURCA"    "MINURCAT"   "MINURSO"   
 [6] "MINUSCA"    "MINUSMA"    "MONUA"      "MONUC"      "MONUSCO"   
[11] "ONUB"       "ONUMOZ"     "UNAMID"     "UNAMIR"     "UNAMSIL"   
[16] "UNAVEM II"  "UNAVEM III" "UNIOSIL"    "UNIPSIL"    "UNISFA"    
[21] "UNMIL"      "UNMIS"      "UNMISS"     "UNOCI"      "UNOMIL"    
[26] "UNOMSIL"    "UNOSOM II" 

In total there are 27 missions in 23 different countries included in the version 1.2 of the dataset.

str(TotalCount <- with(GeoPKO, table(Mission, country)))
 'table' int [1:27, 1:23] 0 0 0 0 75 0 0 0 0 0 ...
 - attr(*, "dimnames")=List of 2
  ..$ Mission: chr [1:27] "BINUB" "MINUCI" "MINURCA" "MINURCAT" ...
  ..$ country: chr [1:23] "Algeria" "Angola" "Burundi" "Central African Republic" ...

The following table shows missions (bottom row) and countries (top row). It can so be derived that 21 missions are active in only 1 country. Only 1 mission is active in 9 countries at the same time.

table(TotalCount. <- rowSums(TotalCount>0))

 1  2  3  4  9 
21  2  2  1  1 

To see what missions are active in more than three countries we can do the following:

rownames(TotalCount)[TotalCount.>3]
[1] "MONUC" "UNMIS"

The dataset covers the period of 1994-2018. Some missions are still ongoing to this day, while others begun before 1994. From when till when are these missions covered?

GeoPKO %>% select(Mission, year, month) %>% 
  mutate(date=zoo::as.yearmon(str_c(year, month, sep="-"))) %>% group_by(Mission) %>%
  summarize(start_date=min(date), end_date=max(date)) %>% arrange(start_date) -> mission.period


kable(mission.period, caption= "Missions arranged by the earliest start date",
      col.names=c("Mission", "Starting point", "End point")) %>% kable_styling() %>%
  scroll_box(width = "100%", height = "300px")
Missions arranged by the earliest start date
Mission Starting point End point
ONUMOZ Feb 1994 Oct 1994
UNOMIL Apr 1994 Sep 1997
UNAMIR May 1994 Nov 1995
UNOSOM II Jun 1994 Jun 1994
UNAVEM II Jul 1994 Jul 1994
MINURSO Mar 1995 Sep 2018
UNAVEM III Mar 1995 Apr 1997
MONUA Aug 1997 Feb 1999
MINURCA Jun 1998 Jan 2000
UNOMSIL Aug 1998 Sep 1999
MONUC Nov 1999 Apr 2010
UNAMSIL Dec 1999 Dec 2005
MINUCI Aug 2003 Jan 2004
UNMIL Dec 2003 Mar 2018
ONUB Mar 2004 Dec 2006
UNOCI May 2004 Jan 2017
UNMIS Jun 2005 Apr 2011
UNIOSIL Mar 2006 Apr 2008
BINUB Mar 2007 Aug 2009
UNAMID Apr 2008 Oct 2018
UNIPSIL Sep 2008 Sep 2008
MINURCAT Dec 2008 Nov 2010
MONUSCO Jul 2010 Dec 2018
UNISFA Oct 2011 Oct 2018
UNMISS Oct 2011 Nov 2018
MINUSMA Mar 2014 Dec 2018
MINUSCA Oct 2014 Oct 2018

One thing to note from the above table: the starting and end points are not necessarily the official start and end dates of the missions. Since data in GeoPKO is collected from deployment maps, these timestamps reflect the publication dates.

We can also extract the numbers of active missions during 1994-2018 and present the results with a simple line plot.

NoMission <- GeoPKO %>% select(year, Mission) %>% distinct(year, Mission) %>% count(year)

Plot1 <- ggplot(NoMission, aes(x=(as.numeric(year)), y=n)) + geom_point() + geom_line(size=0.5) +
  scale_x_continuous("Year", breaks=seq(1994, 2018, 1))+theme_classic()+
  scale_y_continuous("Number of missions", breaks=seq(0,10,1)) +
  theme(panel.grid=element_blank(), 
        axis.text.x=element_text(angle=45, vjust=0.5)) 
Plot1

Number of troops

The following shows how to calculate the average number of troops per year. In addition, any rows with not troop deployment are excluded.

GeoPKO$NoTroops<-as.numeric(GeoPKO$No.troops)
Warning: NAs introduced by coercion
AverageperYear <- GeoPKO %>% select(Mission, year, country, location, latitude, longitude, NoTroops) %>%
  group_by(Mission, year, location, country) %>%
  mutate(Ave.no.troops = as.integer(mean(NoTroops, na.rm=TRUE))) %>% select(-NoTroops) %>% distinct() %>% drop_na(Ave.no.troops)

AverageperYear<-AverageperYear %>% filter(Ave.no.troops>0)

kable(AverageperYear[1:10,]) %>% kable_styling() %>%
  scroll_box(width = "100%", height = "200px") #displaying the first five rows
Mission year country location latitude longitude Ave.no.troops
MINURCA 1998 Central African Republic Bangui 4.383333 18.566667 1385
MINURCA 1999 Central African Republic Bangui 4.383333 18.566667 1485
MINURCAT 2008 Central African Republic Birao 10.284879 22.788184 650
MINURCAT 2008 Chad Abeche 13.816667 20.816667 3685
MINURCAT 2008 Chad Bahai 15.55 22.91 150
MINURCAT 2008 Chad Farchana 13.59744 21.81167 650
MINURCAT 2008 Chad Goz Beida 12.216667 21.4166667 650
MINURCAT 2008 Chad Guereda 14.516667 22.083333 150
MINURCAT 2008 Chad Iriba 15.116667 22.25 650
MINURCAT 2008 Chad Koukou Angaraha 12.016667 21.683333 150

Troop contributing countries

The GeoPKO dataset contains information on troop-contributing countries per location, but what if we are interested in unique troop-contributing countries for the entire mission?

Other interesting queries

Which mission has both UNMO and UNPOL at the same time?

GeoPKO %>% filter(UNMO..dummy.==1, UNPOL..dummy.==1) %>% distinct(Mission, year, month) %>% 
  kable() %>% kable_styling() %>% scroll_box(width = "100%", height = "200px")
Mission year month
MINUSCA 2016 9
MINUSCA 2017 6
MINUSCA 2017 10
MINUSCA 2018 2
MINUSCA 2018 6
MINUSCA 2018 10
MONUA 1997 8
MONUA 1997 10
MONUA 1997 12
MONUA 1998 1
MONUA 1998 3
MONUA 1998 4
MONUA 1998 6
MONUA 1998 8
MONUA 1998 9
MONUA 1998 10
MONUA 1998 11
MONUA 1999 1
MONUA 1999 2
UNAVEM III 1995 3
UNAVEM III 1995 4
UNAVEM III 1995 5
UNAVEM III 1995 9
UNAVEM III 1995 12
UNAVEM III 1996 1
UNAVEM III 1996 3
UNAVEM III 1996 6
UNAVEM III 1996 9
UNAVEM III 1997 2
UNAVEM III 1997 3
UNAVEM III 1997 4
UNISFA 2018 4
UNISFA 2018 5
UNISFA 2018 8
UNISFA 2018 10
UNMIL 2013 2
UNMIL 2013 7
UNMIL 2014 2
UNMIL 2014 7
UNMIL 2014 11
UNMIL 2015 1
UNMIL 2015 4
UNMIL 2015 8
UNMIL 2016 2
UNMIL 2016 8
UNMIL 2016 11
UNMIL 2017 2
UNMIL 2017 6
UNMIS 2005 9
UNMIS 2005 12
UNMIS 2006 3
UNMIS 2006 9
UNMIS 2007 1
UNMIS 2007 4
UNMIS 2007 8
UNMIS 2007 10
UNMIS 2008 4
UNMIS 2009 1
UNMIS 2009 10
UNMIS 2010 1
UNMIS 2010 4
UNOCI 2006 12
UNOCI 2007 3
UNOCI 2007 5
UNOCI 2007 9
UNOCI 2007 12
UNOCI 2008 3
UNOCI 2008 6
UNOCI 2008 10
UNOCI 2009 1
UNOCI 2009 4
UNOCI 2009 7
UNOCI 2009 9
UNOCI 2010 1
UNOCI 2010 5
UNOCI 2010 11
UNOCI 2011 2
UNOCI 2011 3
UNOCI 2011 6
UNOCI 2011 7
UNOCI 2011 10
UNOCI 2011 12
UNOCI 2012 5
UNOCI 2012 6
UNOCI 2012 10
UNOCI 2012 12
UNOCI 2012 2
UNOCI 2012 3
UNOCI 2013 1
UNOCI 2013 3
UNOCI 2013 6
UNOCI 2013 12
UNOCI 2014 2
UNOCI 2014 5
UNOCI 2014 12
UNOCI 2015 1
UNOCI 2015 5
UNOCI 2015 12
UNOCI 2016 2
UNOCI 2016 3
UNOCI 2017 1

sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=English_Sweden.1252  LC_CTYPE=English_Sweden.1252   
[3] LC_MONETARY=English_Sweden.1252 LC_NUMERIC=C                   
[5] LC_TIME=English_Sweden.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] lubridate_1.7.8  kableExtra_1.1.0 knitr_1.29.3     ggthemes_4.2.0  
 [5] forcats_0.5.0    stringr_1.4.0    dplyr_0.8.3      purrr_0.3.4     
 [9] readr_1.3.1      tidyr_1.0.0      tibble_3.0.1     ggplot2_3.3.2   
[13] tidyverse_1.3.0  workflowr_1.6.2 

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.4.6      lattice_0.20-38   zoo_1.8-8         assertthat_0.2.1 
 [5] rprojroot_1.3-2   digest_0.6.25     R6_2.4.1          cellranger_1.1.0 
 [9] backports_1.1.7   reprex_0.3.0      evaluate_0.14     httr_1.4.1       
[13] highr_0.8         pillar_1.4.4      rlang_0.4.7       readxl_1.3.1     
[17] rstudioapi_0.11   whisker_0.4       rmarkdown_1.18    webshot_0.5.2    
[21] munsell_0.5.0     broom_0.5.6       compiler_3.5.2    httpuv_1.5.2     
[25] modelr_0.1.5      xfun_0.15         pkgconfig_2.0.3   htmltools_0.5.0  
[29] tidyselect_0.2.5  fansi_0.4.1       viridisLite_0.3.0 crayon_1.3.4     
[33] dbplyr_1.4.2      withr_2.2.0       later_1.0.0       grid_3.5.2       
[37] nlme_3.1-137      jsonlite_1.6.1    gtable_0.3.0      lifecycle_0.2.0  
[41] DBI_1.1.0         git2r_0.27.1      magrittr_1.5      scales_1.1.1     
[45] cli_2.0.2         stringi_1.4.6     farver_2.0.3      fs_1.4.1         
[49] promises_1.1.0    xml2_1.3.2        ellipsis_0.3.1    generics_0.0.2   
[53] vctrs_0.3.1       tools_3.5.2       glue_1.4.1        hms_0.5.3        
[57] yaml_2.2.1        colorspace_1.4-1  rvest_0.3.5       haven_2.2.0