The US Geological Survey publishes a list of Strategic Minerals (https://www.usgs.gov/news/national-news-release/us-geological-survey-releases-2022-list-critical-minerals ). Having a secure supply of these minerals is essential to our security and economic prosperity. However, many of these minerals are sourced from outside of the US. This assignment is to develop a reference catalog of the source or sources of each of these minerals and a judgement on the reliability of each source under stressed circumstance (e.g. war, economic crisis, etc.).
library(tidyverse)
library(httr)
library(jsonlite)
library(dplyr)
library(ggplot2)
library(reshape2)
library(usmap)
library(tinytex)
library(paletteer)
library(gapminder)
url <- "https://raw.githubusercontent.com/Stevee-G/Data608/refs/heads/main/Assignment7/min_list.csv"
url1 <- "https://raw.githubusercontent.com/Stevee-G/Data608/refs/heads/main/Assignment7/ofr20051294/deposit.csv"
url2 <- "https://raw.githubusercontent.com/Stevee-G/Data608/refs/heads/main/Assignment7/us_allies.csv"
url3 <- "https://raw.githubusercontent.com/Stevee-G/Data608/refs/heads/main/Assignment7/us_rivals.csv"
min_list <- read_csv(url)
minerals <- read_csv(url1)
allies <- read_csv(url2)
competitors <- read_csv(url3)
glimpse(min_list)
## Rows: 50
## Columns: 1
## $ Mineral <chr> "Aluminum", "Antimony", "Arsenic", "Barite", "Beryllium", "Bis…
glimpse(minerals)
## Rows: 3,168
## Columns: 13
## $ gid <dbl> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,…
## $ dep_name <chr> "Obatu-Shela", "Hagigak", "Darrahe-Nur", "Loghar", "Aynak"…
## $ country <chr> "Afghanistan", "Afghanistan", "Afghanistan", "Afghanistan"…
## $ state <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ latitude <dbl> 32.0000, 34.6778, 34.6611, 34.1670, 34.2660, 32.3128, 35.4…
## $ longitude <dbl> 66.2833, 68.0625, 70.5417, 68.0330, 69.3010, 66.5328, 69.7…
## $ commodity <chr> "Aluminum", "Barite", "Beryllium-niobium,tin", "Chromium",…
## $ dep_type <chr> "Surficial", "Hydrothermal", "Igneous", "Igneous", "Sedime…
## $ type_detail <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ model_code <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ model_name <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ metallic <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ citation <chr> "Orris and Bliss, 2002", "Orris and Bliss, 2002", "Orris a…
glimpse(allies)
## Rows: 102
## Columns: 2
## $ Country <chr> "Albania", "Algeria", "American Samoa", "Argentina", "Armenia"…
## $ Status <chr> "Ally", "Ally", "Ally", "Ally", "Ally", "Ally", "Ally", "Ally"…
glimpse(competitors)
## Rows: 22
## Columns: 2
## $ Country <chr> "Afghanistan", "Belarus", "China", "Cuba", "Eritrea", "Iran", …
## $ Status <chr> "Enemy", "Enemy", "Enemy", "Enemy", "Enemy", "Enemy", "Enemy",…
min_trim <- minerals %>%
select(commodity, country,
latitude, longitude) %>%
arrange(commodity, country)
glimpse(min_trim)
## Rows: 3,168
## Columns: 4
## $ commodity <chr> "Aluminum", "Aluminum", "Aluminum", "Aluminum", "Aluminum", …
## $ country <chr> "Afghanistan", "Australia", "Australia", "Australia", "Austr…
## $ latitude <dbl> 32.0000, -12.3000, -15.2167, -32.9333, -12.6667, -2.0000, -0…
## $ longitude <dbl> 66.28330, 136.75000, 125.93330, 116.10000, 141.91670, -58.00…
countries <- bind_rows(allies, competitors)
countries$reliability <- case_when(
countries$Status == 'Ally' ~ 'Ally',
countries$Status == 'Former enemy' ~ 'Neutral',
countries$Status == 'Enemy' ~ 'Competitor'
)
countries <- countries %>%
select(Country, reliability)
glimpse(countries)
## Rows: 124
## Columns: 2
## $ Country <chr> "Albania", "Algeria", "American Samoa", "Argentina", "Arme…
## $ reliability <chr> "Ally", "Ally", "Ally", "Ally", "Ally", "Ally", "Ally", "A…
all <- right_join(countries,
inner_join(min_trim,
min_list,join_by(commodity == Mineral),
relationship = 'many-to-one'),
join_by(Country == country),
relationship = 'one-to-many') %>%
arrange(commodity, Country)
all$reliability <- all$reliability %>%
replace_na('Neutral')
all$line_score <- case_when(
all$reliability == 'Ally' ~ 1,
all$reliability == 'Neutral' ~ 0,
all$reliability == 'Competitor' ~ -1
)
glimpse(all)
## Rows: 531
## Columns: 6
## $ Country <chr> "Afghanistan", "Australia", "Australia", "Australia", "Aus…
## $ reliability <chr> "Competitor", "Ally", "Ally", "Ally", "Ally", "Ally", "All…
## $ commodity <chr> "Aluminum", "Aluminum", "Aluminum", "Aluminum", "Aluminum"…
## $ latitude <dbl> 32.0000, -12.3000, -15.2167, -32.9333, -12.6667, -2.0000, …
## $ longitude <dbl> 66.28330, 136.75000, 125.93330, 116.10000, 141.91670, -58.…
## $ line_score <dbl> -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, -1, -1, -1, -1, -1…
availability <- all %>%
group_by(commodity) %>%
summarize(
'# countries' = n(),
access = sum(line_score)
) %>%
ungroup()
glimpse(availability)
## Rows: 22
## Columns: 3
## $ commodity <chr> "Aluminum", "Antimony", "Arsenic", "Barite", "Chromium",…
## $ `# countries` <int> 73, 6, 1, 24, 84, 1, 18, 42, 8, 18, 46, 20, 3, 10, 1, 5,…
## $ access <dbl> 11, 6, 1, 10, -25, 1, 8, 13, 2, 10, 18, 9, -1, -7, 1, 0,…
ggplot(availability, aes(reorder(commodity, `# countries`),
`# countries`), fill = `# countries`) +
geom_bar(stat = "identity") +
scale_fill_paletteer_c('ggthemes::Blue-Green Sequential') +
labs(title = "Barplot: Number of Countries Mining Each Mineral",
x = "") +
theme_minimal() +
theme(legend.position = "bottom") +
theme(plot.title = element_text(hjust = 0.5)) +
coord_flip()
ggplot(availability, aes(reorder(commodity, access),
access), fill = access) +
geom_bar(stat = "identity") +
scale_fill_paletteer_c('ggthemes::Blue-Green Sequential') +
labs(title = "Barplot: Mineral Reliability",
x = "") +
theme_minimal() +
theme(legend.position = "bottom") +
theme(plot.title = element_text(hjust = 0.5)) +
coord_flip()
Mineral List:
Mineral Data:
https://mrdata.usgs.gov/major-deposits/
Ally Data:
https://worldpopulationreview.com/country-rankings/united-states-allies
Competitor Data:
https://worldpopulationreview.com/country-rankings/us-enemy-countries