Installing package into 'C:/Users/alyss/AppData/Local/R/win-library/4.2'
(as 'lib' is unspecified)
package 'readr' successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\alyss\AppData\Local\Temp\RtmpqmxmVf\downloaded_packages
install.packages("here")
Installing package into 'C:/Users/alyss/AppData/Local/R/win-library/4.2'
(as 'lib' is unspecified)
package 'here' successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\alyss\AppData\Local\Temp\RtmpqmxmVf\downloaded_packages
── 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
# creating a file path path_to_sheet <-here("data_raw", "CM_Data_Explorer.xlsx")#read in 2.3 EV sheetread_EV_sheet <-partial(.f = read_excel,path = path_to_sheet,sheet ="2.3 EV",col_names =FALSE)# provide the rangesheet_header_EV <-read_EV_sheet(range ="A4:W5")
sheet_header_EV_processed <- sheet_header_EV |># transpose the datat() |># turn it back into a tibbleas_tibble() |># make them meaningfulrename(scenario = V1, year = V2) |># fill scenario downfill(scenario) |>#insert "Current" at topreplace_na(list(scenario ="Current Year"))
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`.
ggplot(final_iea_EV_table) +aes(x = scenario, y = value, colour = indicator) +geom_col(fill ="#112446") +scale_fill_distiller() +labs(x ="Demand by Scenario",y ="Thousands of Tons (Kt)",title ="EV Mineral Demand By Scenario",subtitle ="Demand for Critical Minerals is Highest in a Net Zeros by 2050 Scenario",caption ="Data from IEA | Insights by Alyssa Anderson",color ="Critical Mineral" ) +theme_minimal()+theme(legend.position ="none")+theme(axis.text.x =element_text(angle =45, hjust =1, size =7 ))
filtered_copper_graphite <- final_iea_EV_table %>%filter(indicator =="Copper"| indicator =="Graphite")ggplot(filtered_copper_graphite) +aes(x = value, y = tech_scenario, colour = indicator) +geom_boxplot(fill ="#112446") +scale_color_manual(values =c(Copper ="#B87333",Graphite ="#808080") ) +labs(x ="Graphite and Copper Demand (kt)",y ="Scenarios",title ="Comparison of Copper and Graphite Demand",subtitle ="Battery Size Reduction or Constrained Nickel Supply will Drive up Demand",caption ="Data from IEA | Insights by Alyssa Anderson",color ="Mineral" ) +theme_minimal()+theme(plot.title =element_text(hjust =0), # Align title text to the leftplot.title.position ="plot"# Position title relative to the plot area )