diff --git a/R/indicator_introduction_year.R b/R/indicator_introduction_year.R index fbad97c9..9f3c1e07 100644 --- a/R/indicator_introduction_year.R +++ b/R/indicator_introduction_year.R @@ -138,8 +138,8 @@ indicator_introduction_year <- function(df, # Rename to default column name df <- df %>% - dplyr::rename_at(vars(first_observed), ~"first_observed") %>% - dplyr::rename_at(vars(taxon_key_col), ~"key") + dplyr::rename_with(.fn = ~"first_observed", .cols = one_of(first_observed)) %>% + dplyr::rename_with(.fn = ~"key", .cols= one_of(taxon_key_col)) # Provide warning messages for first_observed NA values n_first_observed_not_present <- diff --git a/R/indicator_total_year.R b/R/indicator_total_year.R index c638db0a..bb3d360a 100644 --- a/R/indicator_total_year.R +++ b/R/indicator_total_year.R @@ -142,8 +142,8 @@ indicator_total_year <- function(df, start_year_plot = 1940, # rename to default column name df <- df %>% - rename_at(vars(first_observed), ~"first_observed") %>% - rename_at(vars(taxon_key_col), ~"key") + dplyr::rename_with(.fn = ~"first_observed", .cols = one_of(first_observed)) %>% + dplyr::rename_with(.fn = ~"key", .cols= one_of(taxon_key_col)) # Provide warning messages for first_observed NA values n_first_observed_not_present <-