[conflicted] Will prefer dplyr::filter over any other package.
Problem 1:
Your boss knows that they will be asking her about how the implications of the electric vehicle (EV) market and policy choices on the demand for copper and cobalt.
1. Use the workflow developed in this chapter to import and tidy worksheet 2.3 EV from the dataset.
Warning: The `x` argument of `as_tibble.matrix()` must have unique column names if
`.name_repair` is omitted as of tibble 2.0.0.
ℹ Using compatibility `.name_repair`.
sheet_header_processed
# A tibble: 23 × 2
scenario year
<chr> <chr>
1 Current Year <NA>
2 Current Year 2022
3 Current Year <NA>
4 Stated policies scenario 2025
5 Stated policies scenario 2030
6 Stated policies scenario 2035
7 Stated policies scenario 2040
8 Stated policies scenario 2045
9 Stated policies scenario 2050
10 Stated policies scenario <NA>
# ℹ 13 more rows
2. Use the tidied dataset to come up with 5 compelling data visualizations that illustrate key actionable insights about how policy scenarios, and technological scenarios will impact demand for copper and cobalt.
data visualization 1: bar chart of Copper and Cobalt Demand In Different Scenarios and Time
cobalt <- combined_data[combined_data$indicator =="Cobalt", ]copper <- combined_data[combined_data$indicator =="Copper", ]combined_metals <-rbind(transform(cobalt, metal ="Cobalt"),transform(copper, metal ="Copper"))ggplot(combined_metals, aes(x = year, y = value, fill = scenario)) +geom_bar(stat ="identity", position ="dodge") +facet_wrap(~ metal, scales ="free_y") +labs(title ="Copper and Cobalt Demand In Different Scenarios and Time", x ="Year", y ="Demand (kiloton)", fill ="Scenario") +theme_minimal()
data visualization 2: bar chart of Copper and Cobalt Demand Comparison Over Time
copper_cobalt_data <- final_EV_table %>%filter(indicator %in%c("Copper", "Cobalt"))ggplot(copper_cobalt_data, aes(x =factor(year), y = value, fill = indicator)) +geom_bar(stat ="identity", position =position_dodge()) +labs(title ="Copper and Cobalt Demand Comparison Over Time",x ="Year",y ="Demand (kiloton)",fill ="Metal") +theme_minimal()