Data_Analysis_5

Author

Joe Aumuller

Data & Packages

Show the code
library(tidyverse)
Warning: package 'tidyverse' was built under R version 4.2.2
── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
✔ ggplot2 3.4.0     ✔ purrr   1.0.1
✔ tibble  3.1.8     ✔ dplyr   1.1.0
✔ tidyr   1.3.0     ✔ stringr 1.5.0
✔ readr   2.1.3     ✔ forcats 1.0.0
Warning: package 'ggplot2' was built under R version 4.2.2
Warning: package 'tidyr' was built under R version 4.2.2
Warning: package 'readr' was built under R version 4.2.2
Warning: package 'purrr' was built under R version 4.2.2
Warning: package 'dplyr' was built under R version 4.2.2
Warning: package 'stringr' was built under R version 4.2.2
Warning: package 'forcats' was built under R version 4.2.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
Show the code
library(purrr)
library(ggridges)
Warning: package 'ggridges' was built under R version 4.2.2
Show the code
library(readxl)
Warning: package 'readxl' was built under R version 4.2.2
Show the code
library(stringr)
library(hrbrthemes)
Warning: package 'hrbrthemes' was built under R version 4.2.2
NOTE: Either Arial Narrow or Roboto Condensed fonts are required to use these themes.
      Please use hrbrthemes::import_roboto_condensed() to install Roboto Condensed and
      if Arial Narrow is not on your system, please see https://bit.ly/arialnarrow
Show the code
sheet = excel_sheets("6.4. Production_of_Mineral_Raw_Materials_of_individual_Countries_by_Minerals.xlsx")
minerals = lapply(setNames(sheet, sheet),
                    function(x) read_excel("6.4. Production_of_Mineral_Raw_Materials_of_individual_Countries_by_Minerals.xlsx", sheet=x, skip = 1))
minerals = bind_rows(minerals, .id="Sheet")

mineral_df <- minerals |> gather(Year, Units, '2016':'2020')

DRC Produces Majority of Tantalum

Show the code
library(forcats)

mineral_df %>%
  filter(Country != 'Total', Sheet == 'Tantalum (Ta2O5)') |> 
  group_by(Country) |> 
  ggplot( aes(x=reorder(Country,Units), y=Units)) +
    geom_bar(stat="identity", fill="#f68060", alpha=.6, width=.4) +
    coord_flip() +
    xlab("") +
    theme_bw() +
  facet_wrap(~ Sheet)

DRC Tantalum Curiously Drops from 2016 through 2019 while Rwanda’s Production Marginally Increases

Show the code
mineral_df |> 
  filter(Country == 'Rwanda' | Country == 'Congo, D.R.', Sheet == 'Tantalum (Ta2O5)') |> 
  ggplot(aes(x=Year, y=Units, group = Country, color = Country)) +
    geom_point() +
    geom_line() +
  facet_wrap(~ Sheet)

Diamonds are still the primary production of DRC

Show the code
mineral_df |> 
  filter(Country == 'Congo, D.R.') |> 
  ggplot(aes(Year, Sheet, fill = (Units/1000000))) +
    geom_tile()

Why is this interesting?

The DRC underwent a recent regional conflict with rebel groups in North Kivu province in 2017. Rwanda has been repeatedly accused of looting minerals from DRC throgh its associations with these rebel groups. DRC has also had a long history of blood diamond trade with diamonds as its main mineral production through 2020.