Last updated: 2020-06-29
Checks: 7 0
Knit directory: GeoPKOReport/
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 0a3c9c9. 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: .Rproj.user/
Untracked files:
Untracked: data/geopko.csv
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 | 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 explore the Geo-PKO dataset. More information on the dataset can be found on its homepage.
Load packages.
library(tidyverse)
library(readr)
library(ggthemes)
Import the dataset.
GeoPKO <- read_csv("data/geopko.csv")
Now we can start with the actual fun stuff! Let's have a quick look at the first few rows of the dataset.
head(GeoPKO)
# A tibble: 6 x 71
Source Mission year month location country latitude longitude No.troops RPF
<chr> <chr> <dbl> <dbl> <chr> <chr> <dbl> <dbl> <chr> <lgl>
1 Map n~ BINUB 2007 3 Bujumbu~ Burundi -3.38 29.4 0 NA
2 Map n~ BINUB 2009 8 Bujumbu~ Burundi -3.38 29.4 0 NA
3 Map n~ MINUCI 2003 8 Abidjan Ivory ~ 5.31 -4.01 0 NA
4 Map n~ MINUCI 2003 11 Abidjan Ivory ~ 5.31 -4.01 0 NA
5 Map n~ MINUCI 2004 1 Abidjan Ivory ~ 5.31 -4.01 0 NA
6 Map n~ MINURCA 1998 6 Bangui Centra~ 4.38 18.6 1385 NA
# ... with 61 more variables: RPF_No <lgl>, RES <dbl>, RES_No <dbl>, FP <dbl>,
# FP_No <dbl>, No.TCC <chr>, name.of.TCC1 <chr>, No.troops.per.TCC1 <chr>,
# name.of.TCC2 <chr>, No.troops.per.TCC2 <chr>, name.of.TCC3 <chr>,
# No.troops.per.TCC3 <dbl>, name.of.TCC4 <chr>, No.troops.per.TCC4 <dbl>,
# name.of.TCC5 <chr>, No.troops.per.TCC5 <dbl>, name.of.TCC6 <chr>,
# No.troops.per.TCC6 <dbl>, name.of.TCC7 <chr>, No.troops.per.TCC7 <dbl>,
# name.of.TCC8 <chr>, No.troops.per.TCC8 <dbl>, name.of.TCC9 <chr>,
# No.troops.per.TCC9 <dbl>, name.of.TCC10 <lgl>, No.troops.per.TCC10 <lgl>,
# name.of.TCC11 <lgl>, No.troops.per.TCC11 <lgl>, name.of.TCC12 <lgl>,
# No.troops.per.TCC12 <lgl>, name.of.TCC13 <lgl>, No.troops.per.TCC13 <lgl>,
# name.of.TCC14 <lgl>, No.troops.per.TCC14 <lgl>, UNPOL..dummy. <dbl>,
# UNMO..dummy. <dbl>, HQ <dbl>, LO <dbl>, comments <chr>, cow_code <dbl>,
# gwno <dbl>, name <chr>, TCC1 <dbl>, TCC2 <dbl>, TCC3 <dbl>, TCC4 <dbl>,
# TCC5 <dbl>, TCC6 <dbl>, TCC7 <dbl>, TCC8 <dbl>, TCC9 <dbl>, TCC10 <lgl>,
# TCC11 <lgl>, TCC12 <lgl>, TCC13 <lgl>, TCC14 <lgl>, ADM1_id <dbl>,
# ADM1_name <chr>, ADM2_id <dbl>, ADM2_name <chr>, PRIOID <dbl>
The dataset covers UN peacekeeping missions in Africa between 1994 and 2018. We can use the dataset to extract the number of active missions during this period.
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
sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 16299)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggthemes_4.2.0 forcats_0.5.0 stringr_1.4.0 dplyr_0.8.4
[5] purrr_0.3.3 readr_1.3.1 tidyr_1.0.2 tibble_2.1.3
[9] ggplot2_3.2.1 tidyverse_1.3.0 workflowr_1.6.2
loaded via a namespace (and not attached):
[1] tidyselect_1.0.0 xfun_0.12 haven_2.2.0 lattice_0.20-35
[5] colorspace_1.4-1 vctrs_0.2.3 generics_0.0.2 htmltools_0.4.0
[9] yaml_2.2.1 utf8_1.1.4 rlang_0.4.5 later_1.0.0
[13] pillar_1.4.3 withr_2.1.2 glue_1.4.0 DBI_1.1.0
[17] dbplyr_1.4.2 modelr_0.1.6 readxl_1.3.1 lifecycle_0.1.0
[21] munsell_0.5.0 gtable_0.3.0 cellranger_1.1.0 rvest_0.3.5
[25] evaluate_0.14 knitr_1.28 httpuv_1.5.2 fansi_0.4.1
[29] broom_0.5.5 Rcpp_1.0.4.6 promises_1.1.0 backports_1.1.5
[33] scales_1.1.0 jsonlite_1.6.1 farver_2.0.3 fs_1.3.1
[37] hms_0.5.3 digest_0.6.25 stringi_1.4.6 grid_3.5.0
[41] rprojroot_1.3-2 cli_2.0.2 tools_3.5.0 magrittr_1.5
[45] lazyeval_0.2.2 crayon_1.3.4 whisker_0.4 pkgconfig_2.0.3
[49] xml2_1.2.2 reprex_0.3.0 lubridate_1.7.4 rstudioapi_0.11
[53] assertthat_0.2.1 rmarkdown_2.3 httr_1.4.1 R6_2.4.1
[57] nlme_3.1-137 git2r_0.26.1 compiler_3.5.0