susfin-week6-assignment

Author

Xingyu Pu

Comparison of Absolute Value Growth from 2022 to 2050

The chart illustrate a marked contrast between the two scenarios for Copper, with the “Net Zero Emissions by 2050 scenario” indicating a much higher demand by 2050 compared to the “Stated policies scenario.” This suggests that efforts to achieve net-zero emissions could significantly increase the demand for Copper, likely due to its essential role in renewable energy technologies and infrastructure.

library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ purrr     1.0.2
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.4.4     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.1
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ggplot2)

# Load the dataset
final_minerals_table_EV_modified <- read_csv("data/final_minerals_table_EV_modified.csv")
Rows: 1368 Columns: 6
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (4): EV_tech_assumption, indicator, scenario, unit
dbl (2): year, value

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# Filter data for "Stated policies scenario" and "Net Zero Emissions by 2050 scenario"
filtered_data <- final_minerals_table_EV_modified %>%
  filter(scenario %in% c("Stated policies scenario", "Net Zero Emissions by 2050 scenario")) %>%
  filter(year %in% c(2022, 2050))

# Calculate the absolute value growth from 2022 to 2050 for each indicator within each scenario
growth_data <- filtered_data %>%
  group_by(indicator, scenario) %>%
  summarise(growth = diff(value)) %>%
  ungroup() %>%
  # Remove indicators with 0 growth
  filter(growth != 0)
Warning: Returning more (or less) than 1 row per `summarise()` group was deprecated in
dplyr 1.1.0.
ℹ Please use `reframe()` instead.
ℹ When switching from `summarise()` to `reframe()`, remember that `reframe()`
  always returns an ungrouped data frame and adjust accordingly.
`summarise()` has grouped output by 'indicator', 'scenario'. You can override
using the `.groups` argument.
# Plotting the growth
growth_plot <- ggplot(growth_data, aes(x = indicator, y = growth, fill = scenario)) +
  geom_bar(stat = "identity", position = "dodge") +
  theme_minimal() +
  labs(title = "Absolute Value Growth from 2022 to 2050",
       x = "Indicator",
       y = "Growth (kiloton)",
       fill = "Scenario") +
  theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  # Ensure y-axis starts from 0
  scale_y_continuous(limits = c(0, NA))

print(growth_plot)
Warning: Removed 28 rows containing missing values (`geom_bar()`).

3 Comparison of Copper and Cobalt Demand in 2025

These figures indicate that the demand for both Copper and Cobalt in 2025 varies significantly depending on the technological assumptions about electric vehicle (EV) technologies. Notably, scenarios that imply advancements in battery technology, such as the “Faster uptake of solid state batteries” and “Wider use of silicon-rich anodes,” tend to have higher demands for Cobalt compared to other scenarios. Similarly, the “Constrained nickel supply” scenario predicts the highest demand for Copper, suggesting that constraints on other materials could increase the reliance on Copper in EV technologies.

# Load necessary libraries
library(ggplot2)
library(dplyr)

# Read the dataset
data <- read.csv("data/final_minerals_table_EV_modified.csv")

# Filter data to exclude "Limited battery size reduction" and "STEPS - Base case" for indicators "Copper" and "Cobalt"
filtered_data <- data %>% 
  filter(!EV_tech_assumption %in% c("Limited battery size reduction", "STEPS - Base case"),
         indicator %in% c("Copper", "Cobalt"))

# Assuming you want to focus on a specific year, for example, 2025
filtered_data_2025 <- filtered_data %>%
  filter(year == 2025)

# Plot the filtered data for the year 2025
ggplot(filtered_data_2025, aes(x=EV_tech_assumption, y=value, fill=indicator)) +
  geom_bar(stat="identity", position="dodge") +
  theme_minimal() +
  labs(title="Comparison of Copper and Cobalt Demand in 2025",
       x="Mineral",
       y="Demand (kiloton)",
       fill="Mineral")

4 Scenario Impact on Copper and Cobalt Demand

These results illustrate the significant variation in demand for Copper and Cobalt across different future scenarios, emphasizing the impact of technological advances and policy decisions on mineral demand. Notably, the “Limited battery size reduction” scenario leads to the highest demand for both Copper and Cobalt in 2040, indicating that technological limitations in reducing battery size could significantly increase the demand for these critical minerals. Conversely, scenarios like “Constrained nickel supply” and “Lower battery sizes” generally show lower demand, highlighting the importance of material availability and technological efficiency in shaping future mineral demand

# Load necessary libraries
library(ggplot2)
library(dplyr)

# Read the dataset
data <- read.csv("data/final_minerals_table_EV_modified.csv")

key_years <- subset(data, year %in% c(2030, 2040))

ggplot(key_years, aes(x=factor(year), y=value, fill=scenario)) +
  geom_bar(stat="identity", position=position_dodge()) +
  facet_wrap(~indicator, scales="free_y") +
  theme_minimal() +
  labs(title="Scenario Impact on Copper and Cobalt Demand",
       x="Year",
       y="Demand (kiloton)",
       fill="Scenario")
Warning: Removed 48 rows containing missing values (`geom_bar()`).

5 Copper and Cobalt Demand in the Net Zero Emissions by 2050 Scenario

These figures reveal a significant increase in demand for both Copper and Cobalt as we move towards achieving net zero emissions by 2050. The demand for Copper appears to peak around 2045 before slightly decreasing by 2050, while the demand for Cobalt shows a steady increase throughout the period, reflecting its critical role in the transition to cleaner energy and technologies. This scenario underscores the importance of these materials in supporting a sustainable future, highlighting the challenges and opportunities in securing supply chains and promoting recycling and sustainable mining practices.

library(ggplot2)
library(dplyr)

# Read the dataset
data <- read.csv("data/final_minerals_table_EV_modified.csv")

# Filter and prepare data
filtered_data <- data %>%
  filter(scenario == "Net Zero Emissions by 2050 scenario", indicator %in% c("Copper", "Cobalt")) %>%
  group_by(year, indicator) %>%
  summarise(value = sum(value)) %>% # Replace sum with mean if average is more appropriate
  ungroup() %>%
  mutate(year = as.factor(year))
`summarise()` has grouped output by 'year'. You can override using the
`.groups` argument.
# Calculate scale factor for Cobalt demand to align with Copper demand's scale
max_copper_value <- max(filtered_data$value[filtered_data$indicator == "Copper"])
scale_factor <- max_copper_value / max(filtered_data$value[filtered_data$indicator == "Cobalt"])
filtered_data <- filtered_data %>%
  mutate(adjusted_value = ifelse(indicator == "Cobalt", value * scale_factor, value))

# Create the combined chart
ggplot(filtered_data) +
  geom_bar(data = filtered_data[filtered_data$indicator == "Copper",], aes(x = year, y = value, fill = "Copper"), stat = "identity") +
  geom_line(data = filtered_data[filtered_data$indicator == "Cobalt",], aes(x = year, y = adjusted_value, group = 1, color = "Cobalt")) +
  geom_point(data = filtered_data[filtered_data$indicator == "Cobalt",], aes(x = year, y = adjusted_value, color = "Cobalt")) +
  scale_y_continuous(name = "Copper Demand (kiloton)", sec.axis = sec_axis(~./scale_factor, name = "Cobalt Demand (scaled)")) +
  labs(title = "Copper and Cobalt Demand in the Net Zero Emissions by 2050 Scenario", x = "Year") +
  scale_fill_manual(values = c("Copper" = "orange")) +
  scale_color_manual(values = c("Cobalt" = "blue")) +
  theme_minimal() +
  theme(legend.title = element_blank())