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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: "Phase 1 + 2"
|
| 3 |
+
output: html_document
|
| 4 |
+
date: "2025-06-12"
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
```{r setup, include=FALSE}
|
| 8 |
+
knitr::opts_chunk$set(echo = TRUE)
|
| 9 |
+
```
|
| 10 |
+
|
| 11 |
+
## Phase I
|
| 12 |
+
|
| 13 |
+
```{r cars}
|
| 14 |
+
# Load necessary package
|
| 15 |
+
library(readr)
|
| 16 |
+
library(tidyverse)
|
| 17 |
+
library(readxl)
|
| 18 |
+
library(ggplot2)
|
| 19 |
+
library(dplyr)
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
```{r pressure, echo=FALSE}
|
| 23 |
+
df <- read_csv("TradeData_6_17_2025_14_10_57.csv", locale = locale(encoding = "ISO-8859-1"))
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
```{r}
|
| 27 |
+
# Define classification mapping
|
| 28 |
+
mineral_type <- c(
|
| 29 |
+
"Copper ores and concentrates" = "Raw + processed",
|
| 30 |
+
"Carbonates; lithium carbonate" = "Processed",
|
| 31 |
+
"Cobalt; mattes and other intermediate products of cobalt metallurgy, cobalt and articles thereof, including waste and scrap" = "Processed",
|
| 32 |
+
"Copper; refined and copper alloys, unwrought" = "Processed + raw",
|
| 33 |
+
"Graphite; natural" = "Raw",
|
| 34 |
+
"Cobalt ores and concentrates" = "Raw + processed",
|
| 35 |
+
"Cobalt oxides and hydroxides; commercial cobalt oxides" = "Processed",
|
| 36 |
+
"Lithium oxide and hydroxide" = "Processed",
|
| 37 |
+
"Nickel ores and concentrates" = "Raw + processed",
|
| 38 |
+
"Nickel; unwrought" = "raw",
|
| 39 |
+
"Manganese ores and concentrates, including ferruginous manganese ores and concentrates with a manganese content of 20% or more, calculated on the dry weight" = "raw + processed"
|
| 40 |
+
)
|
| 41 |
+
|
| 42 |
+
# Only contain the mineral's ores and concentrates.
|
| 43 |
+
ore_con = c("Cobalt ores and concentrates (Raw + processed)",
|
| 44 |
+
"Copper ores and concentrates (Raw + processed)",
|
| 45 |
+
"Graphite; natural (Raw)",
|
| 46 |
+
"Nickel ores and concentrates (Raw + processed)",
|
| 47 |
+
"Manganese ores and concentrates, including ferruginous manganese ores and concentrates with a manganese content of 20% or more, calculated on the dry weight (raw + processed)",
|
| 48 |
+
"Lithium oxide and hydroxide (Processed)")
|
| 49 |
+
|
| 50 |
+
df2 <- df %>%
|
| 51 |
+
mutate(cmdDesc = paste0(cmdDesc, " (", mineral_type[cmdDesc], ")"))
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
summary = df2 %>%
|
| 55 |
+
group_by(reporterDesc, cmdDesc) %>%
|
| 56 |
+
summarise(NetWeight_kg = sum(netWgt, na.rm = TRUE), .groups = "drop")
|
| 57 |
+
#View(summary)
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
```{r}
|
| 61 |
+
summary_wide <- summary %>%
|
| 62 |
+
pivot_wider(names_from = cmdDesc, values_from = NetWeight_kg, values_fill = 0)
|
| 63 |
+
|
| 64 |
+
summary_wide <- summary_wide %>%
|
| 65 |
+
mutate(Participation_Count = rowSums(select(., -reporterDesc) > 0))
|
| 66 |
+
|
| 67 |
+
# View result
|
| 68 |
+
#View(summary_wide)
|
| 69 |
+
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
### Without China
|
| 73 |
+
|
| 74 |
+
```{r}
|
| 75 |
+
fmf_countries <- c("Algeria", "Angola", "Benin", "Botswana", "Burkina Faso", "Burundi",
|
| 76 |
+
"Cabo Verde", "Cameroon", "Central African Republic", "Chad",
|
| 77 |
+
"Comoros", "Democratic Republic of the Congo", "Republic of the Congo",
|
| 78 |
+
"Côte d’Ivoire", "Djibouti", "Egypt", "Equatorial Guinea", "Eritrea",
|
| 79 |
+
"Eswatini", "Ethiopia", "Gabon", "Gambia", "Ghana", "Guinea",
|
| 80 |
+
"Guinea-Bissau", "Kenya", "Lesotho", "Liberia", "Libya", "Madagascar",
|
| 81 |
+
"Malawi", "Mali", "Mauritania", "Mauritius", "Morocco", "Mozambique",
|
| 82 |
+
"Namibia", "Niger", "Nigeria", "Rwanda", "São Tomé and Príncipe",
|
| 83 |
+
"Senegal", "Seychelles", "Sierra Leone", "Somalia", "South Africa",
|
| 84 |
+
"South Sudan", "Sudan", "Tanzania", "Togo", "Tunisia", "Uganda",
|
| 85 |
+
"Zambia", "Zimbabwe", "Kazakhstan", "Kyrgyzstan", "Tajikistan", "Turkmenistan", "Uzbekistan", "Bahrain", "Cyprus", "Egypt", "Iran", "Iraq", "Israel", "Jordan",
|
| 86 |
+
"Kuwait", "Lebanon", "Oman", "Palestine", "Qatar", "Saudi Arabia",
|
| 87 |
+
"Syria", "Turkey", "United Arab Emirates", "Yemen","Congo, Dem. Rep.")
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
df_fmf <- df2 %>%
|
| 91 |
+
filter(reporterDesc %in% fmf_countries)
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
country_totals <- df_fmf %>%
|
| 96 |
+
group_by(reporterDesc, cmdDesc) %>%
|
| 97 |
+
summarise(NetWeight_kg = sum(netWgt, na.rm = TRUE), .groups = "drop")
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
# Total export per mineral
|
| 101 |
+
mineral_totals <- country_totals %>%
|
| 102 |
+
group_by(cmdDesc) %>%
|
| 103 |
+
summarise(TotalMineralWeight = sum(NetWeight_kg, na.rm = TRUE))
|
| 104 |
+
|
| 105 |
+
# Join and calculate share
|
| 106 |
+
participation_share <- country_totals %>%
|
| 107 |
+
left_join(mineral_totals, by = "cmdDesc") %>%
|
| 108 |
+
mutate(Participation_Share = round(100 * NetWeight_kg / TotalMineralWeight, 4)) %>%
|
| 109 |
+
mutate(
|
| 110 |
+
Scale_1_to_6 = case_when(
|
| 111 |
+
Participation_Share >= 90 ~ 6,
|
| 112 |
+
Participation_Share >= 70 ~ 5,
|
| 113 |
+
Participation_Share >= 50 ~ 4,
|
| 114 |
+
Participation_Share >= 30 ~ 3,
|
| 115 |
+
Participation_Share >= 10 ~ 2,
|
| 116 |
+
Participation_Share < 10 ~ 1
|
| 117 |
+
))
|
| 118 |
+
|
| 119 |
+
# Only Contain ore and concentrates:
|
| 120 |
+
participation_share_ore = participation_share %>% filter(cmdDesc %in% ore_con)
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
```
|
| 126 |
+
|
| 127 |
+
### With China
|
| 128 |
+
|
| 129 |
+
```{r}
|
| 130 |
+
fmf_CN <- c("Algeria", "Angola", "Benin", "Botswana", "Burkina Faso", "Burundi",
|
| 131 |
+
"Cabo Verde", "Cameroon", "Central African Republic", "Chad",
|
| 132 |
+
"Comoros", "Democratic Republic of the Congo", "Republic of the Congo",
|
| 133 |
+
"Côte d’Ivoire", "Djibouti", "Egypt", "Equatorial Guinea", "Eritrea",
|
| 134 |
+
"Eswatini", "Ethiopia", "Gabon", "Gambia", "Ghana", "Guinea",
|
| 135 |
+
"Guinea-Bissau", "Kenya", "Lesotho", "Liberia", "Libya", "Madagascar",
|
| 136 |
+
"Malawi", "Mali", "Mauritania", "Mauritius", "Morocco", "Mozambique",
|
| 137 |
+
"Namibia", "Niger", "Nigeria", "Rwanda", "São Tomé and Príncipe",
|
| 138 |
+
"Senegal", "Seychelles", "Sierra Leone", "Somalia", "South Africa",
|
| 139 |
+
"South Sudan", "Sudan", "Tanzania", "Togo", "Tunisia", "Uganda",
|
| 140 |
+
"Zambia", "Zimbabwe", "Kazakhstan", "Kyrgyzstan", "Tajikistan", "Turkmenistan", "Uzbekistan", "Bahrain", "Cyprus", "Egypt", "Iran", "Iraq", "Israel", "Jordan",
|
| 141 |
+
"Kuwait", "Lebanon", "Oman", "Palestine", "Qatar", "Saudi Arabia",
|
| 142 |
+
"Syria", "Turkey", "United Arab Emirates", "Yemen", "China", "China, Hong Kong SAR")
|
| 143 |
+
|
| 144 |
+
df_china = df2 %>%
|
| 145 |
+
filter(reporterDesc %in% fmf_CN)
|
| 146 |
+
|
| 147 |
+
country_totals_china <- df_china %>%
|
| 148 |
+
group_by(reporterDesc, cmdDesc) %>%
|
| 149 |
+
summarise(NetWeight_kg = sum(netWgt, na.rm = TRUE), .groups = "drop")
|
| 150 |
+
|
| 151 |
+
mineral_totals_china <- country_totals_china %>%
|
| 152 |
+
group_by(cmdDesc) %>%
|
| 153 |
+
summarise(TotalMineralWeight = sum(NetWeight_kg, na.rm = TRUE))
|
| 154 |
+
|
| 155 |
+
participation_share_china <- country_totals_china %>%
|
| 156 |
+
left_join(mineral_totals_china, by = "cmdDesc") %>%
|
| 157 |
+
mutate(Participation_Share = round(100 * NetWeight_kg / TotalMineralWeight, 4)) %>%
|
| 158 |
+
mutate(
|
| 159 |
+
Scale_1_to_6 = case_when(
|
| 160 |
+
Participation_Share >= 90 ~ 6,
|
| 161 |
+
Participation_Share >= 70 ~ 5,
|
| 162 |
+
Participation_Share >= 50 ~ 4,
|
| 163 |
+
Participation_Share >= 30 ~ 3,
|
| 164 |
+
Participation_Share >= 10 ~ 2,
|
| 165 |
+
Participation_Share < 10 ~ 1
|
| 166 |
+
))
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
participation_share_china_ore = participation_share_china %>% filter(cmdDesc %in%ore_con)
|
| 170 |
+
|
| 171 |
+
```
|
| 172 |
+
|
| 173 |
+
```{r}
|
| 174 |
+
# Without China
|
| 175 |
+
participation_wide_percentage <- participation_share %>%
|
| 176 |
+
select(reporterDesc, cmdDesc, Participation_Share) %>%
|
| 177 |
+
pivot_wider(names_from = cmdDesc, values_from = Participation_Share, values_fill = 0)
|
| 178 |
+
|
| 179 |
+
participation_wide_scale <- participation_share %>%
|
| 180 |
+
select(reporterDesc, cmdDesc, Scale_1_to_6) %>%
|
| 181 |
+
pivot_wider(names_from = cmdDesc, values_from = Scale_1_to_6, values_fill = 0)
|
| 182 |
+
|
| 183 |
+
#With China
|
| 184 |
+
participation_wide_percentage_china <- participation_share_china %>%
|
| 185 |
+
select(reporterDesc, cmdDesc, Participation_Share) %>%
|
| 186 |
+
pivot_wider(names_from = cmdDesc, values_from = Participation_Share, values_fill = 0)
|
| 187 |
+
|
| 188 |
+
participation_wide_scale_china <- participation_share_china %>%
|
| 189 |
+
select(reporterDesc, cmdDesc, Scale_1_to_6) %>%
|
| 190 |
+
pivot_wider(names_from = cmdDesc, values_from = Scale_1_to_6, values_fill = 0)
|
| 191 |
+
|
| 192 |
+
# View result
|
| 193 |
+
#print(participation_wide)
|
| 194 |
+
```
|
| 195 |
+
|
| 196 |
+
```{r}
|
| 197 |
+
participation_wide_percentage_ore <- participation_share_ore %>%
|
| 198 |
+
select(reporterDesc, cmdDesc, Participation_Share) %>%
|
| 199 |
+
pivot_wider(names_from = cmdDesc, values_from = Participation_Share, values_fill = 0)
|
| 200 |
+
|
| 201 |
+
participation_wide_scale_ore <- participation_share_ore %>%
|
| 202 |
+
select(reporterDesc, cmdDesc, Scale_1_to_6) %>%
|
| 203 |
+
pivot_wider(names_from = cmdDesc, values_from = Scale_1_to_6, values_fill = 0)
|
| 204 |
+
|
| 205 |
+
#With China
|
| 206 |
+
participation_wide_percentage_china_ore <- participation_share_china_ore %>%
|
| 207 |
+
select(reporterDesc, cmdDesc, Participation_Share) %>%
|
| 208 |
+
pivot_wider(names_from = cmdDesc, values_from = Participation_Share, values_fill = 0)
|
| 209 |
+
|
| 210 |
+
participation_wide_scale_china_ore <- participation_share_china_ore %>%
|
| 211 |
+
select(reporterDesc, cmdDesc, Scale_1_to_6) %>%
|
| 212 |
+
pivot_wider(names_from = cmdDesc, values_from = Scale_1_to_6, values_fill = 0)
|
| 213 |
+
|
| 214 |
+
# Combined percentage and scale table for all minerals and without china
|
| 215 |
+
share <- participation_wide_percentage
|
| 216 |
+
for (col in names(participation_wide_percentage)[-1]) {
|
| 217 |
+
share[[col]] <- paste0(
|
| 218 |
+
round(participation_wide_percentage[[col]], 4), "% (", participation_wide_scale[[col]], ")"
|
| 219 |
+
)
|
| 220 |
+
}
|
| 221 |
+
# Combined percentage and scale table for all minerals and with china
|
| 222 |
+
share_china <- participation_wide_percentage_china
|
| 223 |
+
for (col in names(participation_wide_percentage_china)[-1]) {
|
| 224 |
+
share_china[[col]] <- paste0(
|
| 225 |
+
round(participation_wide_percentage_china[[col]], 4), "% (", participation_wide_scale_china[[col]], ")"
|
| 226 |
+
)
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
# Combined percentage and scale table for ore and concentrates minerals and without china
|
| 230 |
+
share_ore <- participation_wide_percentage_ore
|
| 231 |
+
for (col in names(participation_wide_percentage_ore)[-1]) {
|
| 232 |
+
share_ore[[col]] <- paste0(
|
| 233 |
+
round(participation_wide_percentage_ore[[col]], 4), "% (", participation_wide_scale_ore[[col]], ")"
|
| 234 |
+
)
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
|
| 238 |
+
# Combined percentage and scale table for ore and concentrates minerals and with china
|
| 239 |
+
share_china_ore <- participation_wide_percentage_china_ore
|
| 240 |
+
for (col in names(participation_wide_percentage_china_ore)[-1]) {
|
| 241 |
+
share_china_ore[[col]] <- paste0(
|
| 242 |
+
round(participation_wide_percentage_china_ore[[col]], 4), "% (", participation_wide_scale_china_ore[[col]], ")"
|
| 243 |
+
)
|
| 244 |
+
}
|
| 245 |
+
View(share)
|
| 246 |
+
View(share_china)
|
| 247 |
+
View(share_ore)
|
| 248 |
+
View(share_china_ore)
|
| 249 |
+
|
| 250 |
+
|
| 251 |
+
```
|
| 252 |
+
|
| 253 |
+
```{r fig.height=10, fig.width=18, echo=FALSE, message=FALSE, warning=FALSE}
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
ggplot(participation_share_china, aes(x = reorder(cmdDesc, Scale_1_to_6), y = Scale_1_to_6)) +
|
| 257 |
+
geom_col(fill = "skyblue") +
|
| 258 |
+
facet_wrap(~ reporterDesc) +
|
| 259 |
+
coord_flip() +
|
| 260 |
+
labs(x = "Mineral", y = "Participation Share (%)",
|
| 261 |
+
title = "Participation Share by Mineral and Country (China and FMF)") +
|
| 262 |
+
theme_minimal() +
|
| 263 |
+
theme(
|
| 264 |
+
axis.text.y = element_text(face = "bold")
|
| 265 |
+
)
|
| 266 |
+
|
| 267 |
+
```
|
| 268 |
+
|
| 269 |
+
```{r fig.height=10, fig.width=18, echo=FALSE, message=FALSE, warning=FALSE}
|
| 270 |
+
ggplot(participation_share, aes(x = reorder(cmdDesc, Scale_1_to_6), y = Scale_1_to_6)) +
|
| 271 |
+
geom_col(fill = "skyblue") +
|
| 272 |
+
facet_wrap(~ reporterDesc) +
|
| 273 |
+
coord_flip() +
|
| 274 |
+
labs(x = "Mineral",
|
| 275 |
+
y = "Participation Share (%)",
|
| 276 |
+
title = "Participation Share by Mineral and Country (FMF)") +
|
| 277 |
+
theme_minimal() +
|
| 278 |
+
theme(
|
| 279 |
+
axis.text.y = element_text(face = "bold")
|
| 280 |
+
)
|
| 281 |
+
|
| 282 |
+
```
|
| 283 |
+
|
| 284 |
+
```{r fig.height=10, fig.width=15, echo=FALSE, message=FALSE, warning=FALSE}
|
| 285 |
+
|
| 286 |
+
|
| 287 |
+
ggplot(participation_share_china_ore, aes(x = reorder(cmdDesc, Scale_1_to_6), y = Scale_1_to_6)) +
|
| 288 |
+
geom_col(fill = "skyblue") +
|
| 289 |
+
facet_wrap(~ reporterDesc) +
|
| 290 |
+
coord_flip() +
|
| 291 |
+
labs(x = "Mineral", y = "Participation Share (%)",
|
| 292 |
+
title = "Participation Share by Mineral and Country (China and FMF)") +
|
| 293 |
+
theme_minimal() +
|
| 294 |
+
theme(
|
| 295 |
+
axis.text.y = element_text(face = "bold")
|
| 296 |
+
)
|
| 297 |
+
```
|
| 298 |
+
|
| 299 |
+
```{r fig.height=10, fig.width=15, echo=FALSE, message=FALSE, warning=FALSE}
|
| 300 |
+
|
| 301 |
+
|
| 302 |
+
ggplot(participation_share_ore, aes(x = reorder(cmdDesc, Scale_1_to_6), y = Scale_1_to_6)) +
|
| 303 |
+
geom_col(fill = "skyblue") +
|
| 304 |
+
facet_wrap(~ reporterDesc) +
|
| 305 |
+
coord_flip() +
|
| 306 |
+
labs(x = "Mineral", y = "Participation Share (%)",
|
| 307 |
+
title = "Participation Share by Mineral and FMF") +
|
| 308 |
+
theme_minimal() +
|
| 309 |
+
theme(
|
| 310 |
+
axis.text.y = element_text(face = "bold")
|
| 311 |
+
)
|
| 312 |
+
```
|
| 313 |
+
|
| 314 |
+
## Phase II
|
| 315 |
+
|
| 316 |
+
### Ease of Doing Business
|
| 317 |
+
|
| 318 |
+
```{r}
|
| 319 |
+
edb_ranking = read_excel("Rankings.xlsx", sheet = "Sheet1")
|
| 320 |
+
head(edb_ranking)
|
| 321 |
+
```
|
| 322 |
+
|
| 323 |
+
Old ranking: 1 - 190
|
| 324 |
+
|
| 325 |
+
New Scale bring it down to the new range(1 to 6):
|
| 326 |
+
|
| 327 |
+
6: 1-31
|
| 328 |
+
|
| 329 |
+
5: 32--63
|
| 330 |
+
|
| 331 |
+
4: 64--95
|
| 332 |
+
|
| 333 |
+
3: 96--127
|
| 334 |
+
|
| 335 |
+
2: 128--159
|
| 336 |
+
|
| 337 |
+
1: 160--190
|
| 338 |
+
|
| 339 |
+
```{r}
|
| 340 |
+
ranking_cols <- names(edb_ranking)[-1]
|
| 341 |
+
|
| 342 |
+
|
| 343 |
+
edb_ranking_scaled <- edb_ranking %>%
|
| 344 |
+
mutate(across(
|
| 345 |
+
all_of(ranking_cols),
|
| 346 |
+
~ ntile(-., 6),
|
| 347 |
+
.names = "{.col}_scale"
|
| 348 |
+
))
|
| 349 |
+
|
| 350 |
+
|
| 351 |
+
head(edb_ranking_scaled)
|
| 352 |
+
|
| 353 |
+
fit <- edb_ranking_scaled %>%
|
| 354 |
+
filter(Economy %in% fmf_countries) %>%
|
| 355 |
+
arrange(desc(globalRank_scale))
|
| 356 |
+
```
|
| 357 |
+
|
| 358 |
+
### Resource of government index
|
| 359 |
+
|
| 360 |
+
```{r}
|
| 361 |
+
rgi_mining = read_csv("nrgi_data.csv")
|
| 362 |
+
|
| 363 |
+
rgi_country <- read_excel("2021_Resource_Governance_Index_scores_workbook_English.xlsx", sheet = "2021_RGI_scores ")
|
| 364 |
+
|
| 365 |
+
|
| 366 |
+
View(rgi_country)
|
| 367 |
+
|
| 368 |
+
```
|
| 369 |
+
|
| 370 |
+
```{r}
|
| 371 |
+
|
| 372 |
+
rgi_country_numeric <- rgi_country
|
| 373 |
+
colnames(rgi_country_numeric) <- as.character(unlist(rgi_country_numeric[1, ]))
|
| 374 |
+
|
| 375 |
+
rgi_country_numeric <- rgi_country_numeric[-1, ]
|
| 376 |
+
|
| 377 |
+
|
| 378 |
+
rgi_country_numeric[, 4:ncol(rgi_country_numeric)] <- lapply(rgi_country_numeric[, 4:ncol(rgi_country_numeric)], function(x) as.numeric(as.character(x)))
|
| 379 |
+
|
| 380 |
+
|
| 381 |
+
|
| 382 |
+
```
|
| 383 |
+
|
| 384 |
+
```{r}
|
| 385 |
+
|
| 386 |
+
rescale_bins <- function(x) {
|
| 387 |
+
case_when(
|
| 388 |
+
x >= 90 ~ 6,
|
| 389 |
+
x >= 70 ~ 5,
|
| 390 |
+
x >= 50 ~ 4,
|
| 391 |
+
x >= 30 ~ 3,
|
| 392 |
+
x >= 10 ~ 2,
|
| 393 |
+
x < 10 ~ 1,
|
| 394 |
+
TRUE ~ NA_real_
|
| 395 |
+
)
|
| 396 |
+
}
|
| 397 |
+
|
| 398 |
+
rgi_scaled <- rgi_country_numeric
|
| 399 |
+
rgi_scaled[, 4:ncol(rgi_scaled)] <- lapply(
|
| 400 |
+
rgi_scaled[, 4:ncol(rgi_scaled)],
|
| 401 |
+
rescale_bins
|
| 402 |
+
)
|
| 403 |
+
|
| 404 |
+
=
|
| 405 |
+
rgi_scaled[, 4:ncol(rgi_scaled)] <- lapply(
|
| 406 |
+
rgi_scaled[, 4:ncol(rgi_scaled)],
|
| 407 |
+
function(x) ifelse(is.na(x), 0, x)
|
| 408 |
+
)
|
| 409 |
+
|
| 410 |
+
|
| 411 |
+
View(rgi_scaled)
|
| 412 |
+
```
|
| 413 |
+
|
| 414 |
+
### CPIA
|
| 415 |
+
|
| 416 |
+
```{r}
|
| 417 |
+
|
| 418 |
+
# Read the main data file
|
| 419 |
+
df_data <- read_csv("d8a9bd65-917a-4bf1-9500-5a67bbfe672a_Data.csv")
|
| 420 |
+
|
| 421 |
+
# Read the metadata file
|
| 422 |
+
df_metadata <- read_csv("d8a9bd65-917a-4bf1-9500-5a67bbfe672a_Series - Metadata.csv")
|
| 423 |
+
|
| 424 |
+
# View first few rows of each
|
| 425 |
+
print(head(df_data))
|
| 426 |
+
|
| 427 |
+
|
| 428 |
+
```
|
Rankings.xlsx
ADDED
|
Binary file (18.4 kB). View file
|
|
|
TradeData_6_17_2025_14_10_57.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
d8a9bd65-917a-4bf1-9500-5a67bbfe672a_Data.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
nrgi_data.csv
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name,sector,region,Composite/component,Subcomponent,Indicator,Score2017,Score2021
|
| 2 |
+
Chile ,mining,LAC,Composite,,,81,
|
| 3 |
+
Australia (Western) ,mining,ASIAP,Composite,,,71,
|
| 4 |
+
Colombia ,mining,LAC,Composite,,,69,75
|
| 5 |
+
Indonesia ,mining,ASIAP,Composite,,,68,
|
| 6 |
+
Mongolia ,mining,EURA,Composite,,,64,70
|
| 7 |
+
Peru ,mining,LAC,Composite,,,62,75
|
| 8 |
+
Botswana ,mining,SSA-AF,Composite,,,61,
|
| 9 |
+
Mexico ,mining,LAC,Composite,,,60,59
|
| 10 |
+
Burkina Faso ,mining,SSA-AF,Composite,,,59,
|
| 11 |
+
Philippines ,mining,ASIAP,Composite,,,58,
|
| 12 |
+
South Africa ,mining,SSA-AF,Composite,,,57,
|
| 13 |
+
Ghana ,mining,SSA-AF,Composite,,,56,69
|
| 14 |
+
Niger ,mining,SSA-AF,Composite,,,54,
|
| 15 |
+
Mali ,mining,SSA-AF,Composite,,,53,
|
| 16 |
+
Morocco ,mining,MENA-AF,Composite,,,52,49
|
| 17 |
+
Kyrgyz Republic ,mining,EURA,Composite,,,51,
|
| 18 |
+
Zambia ,mining,SSA-AF,Composite,,,50,
|
| 19 |
+
Tanzania ,mining,SSA-AF,Composite,,,49,58
|
| 20 |
+
Papua New Guinea ,mining,ASIAP,Composite,,,47,
|
| 21 |
+
Sierra Leone ,mining,SSA-AF,Composite,,,46,
|
| 22 |
+
Tunisia ,mining,MENA-AF,Composite,,,46,50
|
| 23 |
+
Liberia ,mining,SSA-AF,Composite,,,44,
|
| 24 |
+
Guatemala ,mining,LAC,Composite,,,41,
|
| 25 |
+
Ethiopia ,mining,SSA-AF,Composite,,,40,
|
| 26 |
+
Guinea ,mining,SSA-AF,Composite,,,38,62
|
| 27 |
+
Lao PDR ,mining,ASIAP,Composite,,,38,
|
| 28 |
+
Madagascar ,mining,SSA-AF,Composite,,,36,
|
| 29 |
+
Afghanistan ,mining,EURA,Composite,,,34,
|
| 30 |
+
Democratic Republic of Congo ,mining,SSA-AF,Composite,,,33,36
|
| 31 |
+
Cambodia ,mining,ASIAP,Composite,,,30,
|
| 32 |
+
Mauritania ,mining,MENA-AF,Composite,,,29,
|
| 33 |
+
Zimbabwe ,mining,SSA-AF,Composite,,,29,
|
| 34 |
+
Myanmar ,mining,ASIAP,Composite,,,27,
|
| 35 |
+
Eritrea ,mining,SSA-AF,Composite,,,10,
|
| 36 |
+
Senegal ,mining,SSA,Composite,,,,75
|
| 37 |
+
Uganda ,mining,SSA-AF,Composite,,,,55
|