From 9de50de8adb5fb5f752b71b5104784149fa4d7d2 Mon Sep 17 00:00:00 2001 From: mrustl Date: Fri, 28 Jun 2024 09:56:10 +0200 Subject: [PATCH] Declare all functions explicitly --- NAMESPACE | 2 ++ R/recalculate_ctop_with_virtualstorage.R | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 4f2cdb4..c42e517 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -19,6 +19,7 @@ export(select_hydrologic_years) importFrom(dplyr,across) importFrom(dplyr,arrange) importFrom(dplyr,bind_rows) +importFrom(dplyr,cur_column) importFrom(dplyr,filter) importFrom(dplyr,first) importFrom(dplyr,group_by) @@ -33,6 +34,7 @@ importFrom(dplyr,rename_with) importFrom(dplyr,select) importFrom(dplyr,summarise) importFrom(dplyr,summarize) +importFrom(dplyr,sym) importFrom(ggplot2,aes) importFrom(ggplot2,geom_col) importFrom(ggplot2,geom_line) diff --git a/R/recalculate_ctop_with_virtualstorage.R b/R/recalculate_ctop_with_virtualstorage.R index d243175..67fc5fd 100644 --- a/R/recalculate_ctop_with_virtualstorage.R +++ b/R/recalculate_ctop_with_virtualstorage.R @@ -38,7 +38,7 @@ combine_dataframes <- function(df_list) { #' @export #' @importFrom tibble tibble #' @importFrom dplyr across arrange first if_else lag group_by mutate summarize -#' rename_with left_join +#' rename_with left_join cur_column sym #' @importFrom tidyselect starts_with #' @importFrom stringr str_replace recalculate_ctop_with_virtualstorage <- function(atm, @@ -102,10 +102,10 @@ vs_list <- lapply(seq_len(length(c_tops)), function(i) { ~ (. + get(paste0("store_", stringr::str_replace(pattern = "_first", replacement = "_sum", - cur_column())))) / Prec_first, + dplyr::cur_column())))) / Prec_first, .names = "cor_{col}"), across(matches("^Prec_cTop.*_sum"), - ~ (. + get(paste0("store_", cur_column()))) / Prec_sum, + ~ (. + get(paste0("store_", dplyr::cur_column()))) / Prec_sum, .names = "cor_{col}") ) @@ -119,7 +119,7 @@ vs_list <- lapply(seq_len(length(c_tops)), function(i) { "tAtm_start", cor_Prec_sel))), by = c("tAtm" = "tAtm_start")) %>% - dplyr::mutate(!!sym(c_tops[i]) := dplyr::if_else(store == 0 & !is.na(.data[[cor_Prec_sel]]), + dplyr::mutate(!!dplyr::sym(c_tops[i]) := dplyr::if_else(store == 0 & !is.na(.data[[cor_Prec_sel]]), .data[[cor_Prec_sel]], .data[[c_tops[i]]]))