diff --git a/R/plot_techmix.R b/R/plot_techmix.R index 3bdb2863..8ab27b6e 100644 --- a/R/plot_techmix.R +++ b/R/plot_techmix.R @@ -16,10 +16,10 @@ #' region == "global" & #' metric %in% c("projected", "corporate_economy", "target_sds") #' ) %>% -#' prep_techmix( -#' span_5yr = TRUE, -#' convert_label = recode_metric_techmix, -#' convert_tech_label = spell_out_technology +#' prep_techmix( +#' span_5yr = TRUE, +#' convert_label = recode_metric_techmix, +#' convert_tech_label = spell_out_technology #' ) #' #' plot_techmix(data) @@ -81,7 +81,7 @@ check_plot_techmix <- function(data, env) { "technology_share", "label", "label_tech" - ) + ) hint_if_missing_names(abort_if_missing_names(data, crucial), "market_share") abort_if_has_zero_rows(data, env = env) diff --git a/R/prep_emission_intensity.R b/R/prep_emission_intensity.R index 08c7abd9..ba60a2b9 100644 --- a/R/prep_emission_intensity.R +++ b/R/prep_emission_intensity.R @@ -23,13 +23,12 @@ prep_emission_intensity <- function(data, convert_label = identity, span_5yr = FALSE) { - check_prep_emission_intensity( data, convert_label = convert_label, span_5yr = span_5yr, env = list(data = substitute(data)) - ) + ) out <- data %>% prep_common() diff --git a/R/prep_techmix.R b/R/prep_techmix.R index 9e2b35b3..aed4b542 100644 --- a/R/prep_techmix.R +++ b/R/prep_techmix.R @@ -40,7 +40,6 @@ prep_techmix <- function(data, convert_label = identity, span_5yr = FALSE, convert_tech_label = identity) { - env <- list(data = substitute(data)) check_prep_techmix( data, @@ -48,7 +47,7 @@ prep_techmix <- function(data, convert_tech_label = convert_tech_label, span_5yr = span_5yr, env = env - ) + ) out <- data %>% prep_common() %>% diff --git a/R/prep_trajectory.R b/R/prep_trajectory.R index 63e1d8af..e4040aa2 100644 --- a/R/prep_trajectory.R +++ b/R/prep_trajectory.R @@ -32,7 +32,6 @@ prep_trajectory <- function(data, convert_label = identity, span_5yr = FALSE, value_col = "percentage_of_initial_production_by_scope") { - env <- list(data = substitute(data)) check_prep_trajectory( data, @@ -40,7 +39,7 @@ prep_trajectory <- function(data, span_5yr = span_5yr, value_col = value_col, env = env - ) + ) data <- data %>% prep_common() %>% @@ -59,7 +58,6 @@ check_prep_trajectory <- function(data, span_5yr, value_col, env) { - stopifnot(is.data.frame(data)) stopifnot(is.function(convert_label)) stopifnot(is.logical(span_5yr)) diff --git a/R/qplot_emission_intensity.R b/R/qplot_emission_intensity.R index 119d2f01..02fea785 100644 --- a/R/qplot_emission_intensity.R +++ b/R/qplot_emission_intensity.R @@ -23,13 +23,13 @@ qplot_emission_intensity <- function(data) { convert_label = to_title, span_5yr = TRUE, env = env - ) + ) data <- prep_emission_intensity( data, convert_label = to_title, span_5yr = TRUE - ) + ) check_plot_emission_intensity(data, env = env) diff --git a/R/qplot_trajectory.R b/R/qplot_trajectory.R index 9a54a88d..e5f5330c 100644 --- a/R/qplot_trajectory.R +++ b/R/qplot_trajectory.R @@ -40,7 +40,7 @@ qplot_trajectory <- function(data) { plot_trajectory( center_y = TRUE, perc_y_scale = TRUE - ) %>% + ) %>% labs_trajectory(data) } diff --git a/tests/testthat/test-prep_trajectory.R b/tests/testthat/test-prep_trajectory.R index b1892b51..f73c4954 100644 --- a/tests/testthat/test-prep_trajectory.R +++ b/tests/testthat/test-prep_trajectory.R @@ -21,7 +21,6 @@ test_that("returns expected columns", { }) test_that("handles value_col correctly", { - test_data_dif_value_col <- test_data %>% rename(new_column = percentage_of_initial_production_by_scope) @@ -31,13 +30,12 @@ test_that("handles value_col correctly", { expect_equal( setdiff(names(result), names(result_dif_col)), "percentage_of_initial_production_by_scope" - ) + ) expect_equal( setdiff(names(result_dif_col), names(result)), "new_column" ) - }) test_that("handles span_5yr correctly", {