Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deal with the malformed CSV text from IEA-EV-dataEVsalesCarsProjection-APS.csv #46

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions R/prepare_weo_2022_scenario.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
#' `WEO2022_NZE_SteelData.csv`.
#' @param weo_2022_sales_aps_auto_raw A data frame containing a raw import of
#' `SalesAPS_rawdata.csv`.
#' @param weo_2022_electric_sales_aps_auto_raw A data frame containing a raw
#' import of `IEA-EV-dataEV salesCarsProjection-APS.csv`.
#' @param weo_2022_electric_sales_aps_auto_raw_text A vector of character
#' strings containing each line of a raw import of `IEA-EV-dataEV
#' salesCarsProjection-APS.csv`.
#'
#' @return A prepared WEO 2022 scenario data-frame.
#'
Expand All @@ -27,7 +28,19 @@ prepare_weo_2022_scenario <- function(weo_2022_ext_data_regions_raw,
weo_2022_nze_auto_raw,
weo_2022_nze_steel_raw,
weo_2022_sales_aps_auto_raw,
weo_2022_electric_sales_aps_auto_raw) {
weo_2022_electric_sales_aps_auto_raw_text) {
lines_to_fix <- 3:length(weo_2022_electric_sales_aps_auto_raw_text)
weo_2022_electric_sales_aps_auto_raw_text[lines_to_fix] <-
paste0(
weo_2022_electric_sales_aps_auto_raw_text[lines_to_fix],
",https://www.iea.org/reports/global-ev-outlook-2022/executive-summary"
)
weo_2022_electric_sales_aps_auto_raw <-
readr::read_csv(
file = I(weo_2022_electric_sales_aps_auto_raw_text),
show_col_types = FALSE
)

fossil_fuel <-
weo_2022_fossil_fuels_raw %>%
dplyr::filter(.data[["Variable"]] == "Supply")
Expand Down
6 changes: 3 additions & 3 deletions man/prepare_weo_2022_scenario.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading