forked from rorads/DAC-multilateral-core-support-mapping
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dac_Multilateral_Retrieval.r
31 lines (24 loc) · 1.29 KB
/
Dac_Multilateral_Retrieval.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# This script takes the 'Members' total use of the multilateral system' table from the OECD.stat page, at https://stats.oecd.org/DownloadFiles.aspx?DatasetCode=MULTISYSTEM.
# The file initially comes in a '|' separated format, which for some reason doesn't play nice with R. As such it needs to be converted to CSV in excel first, ideally.
#### Setup ####
library(dplyr)
# Change this to the folder with the zip project
setwd('/Users/roryscott/Organisation/Projects/Coverage/dac_multilateral_core_support_by_agency/data/')
# Load the file (could possibly be done with an API Call but CBA right now)
mums = read.csv("MultiSystem entire dataset.csv")
# Extract all of the 'Multilateral Core' records
B02 = subset(mums, Aid_T == "B02")
remove(mums)
#### Diagnostics for 2014 ####
#
# # Sweden table + spend
# sweden_2014 = subset(B02, Year == 2014 & donornameE == "Sweden")
# total_sweden_spend_2014 = sum(sweden_2014$usd_extended_defl, na.rm = 1)
#
# # Netherlands table + spend
# netherlands_2014 = subset(B02, Year == 2014 & donornameE == "Netherlands")
# total_netherlands_spend_2014 = sum(netherlands_2014$usd_extended_defl, na.rm = 1)
#
# # United Kingdom table + spend
# UK_2014 = subset(B02, Year == 2014 & donornameE == "United Kingdom")
# total_UK_spend_2014 = sum(UK_2014$usd_extended_defl, na.rm = 1)