From f96e4bf9ee8cfb9730c471cf3d760173ec7b0a20 Mon Sep 17 00:00:00 2001 From: dsweber2 Date: Wed, 17 Jan 2024 16:48:53 -0800 Subject: [PATCH 1/2] fix: load_all patch, and Roxygen update --- DESCRIPTION | 2 +- NAMESPACE | 4 ++-- R/create-layer.R | 2 +- R/get_test_data.R | 2 +- R/make_quantile_reg.R | 5 ++++- R/make_smooth_quantile_reg.R | 5 ++++- 6 files changed, 13 insertions(+), 7 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index f361cccec..f91b64d28 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -71,4 +71,4 @@ Config/testthat/edition: 3 Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.0 diff --git a/NAMESPACE b/NAMESPACE index ffa7432e1..9beb39a88 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -203,9 +203,9 @@ importFrom(quantreg,rq) importFrom(recipes,bake) importFrom(recipes,prep) importFrom(rlang,"!!") +importFrom(rlang,"%@%") +importFrom(rlang,"%||%") importFrom(rlang,":=") -importFrom(rlang,`%@%`) -importFrom(rlang,`%||%`) importFrom(rlang,abort) importFrom(rlang,caller_env) importFrom(rlang,is_empty) diff --git a/R/create-layer.R b/R/create-layer.R index fee279796..69aeee7eb 100644 --- a/R/create-layer.R +++ b/R/create-layer.R @@ -6,7 +6,7 @@ #' #' @inheritParams usethis::use_test #' -#' @importFrom rlang `%||%` +#' @importFrom rlang %||% #' @export #' #' @examples diff --git a/R/get_test_data.R b/R/get_test_data.R index b4c8a2eb2..e76715daf 100644 --- a/R/get_test_data.R +++ b/R/get_test_data.R @@ -40,7 +40,7 @@ #' step_epi_lag(death_rate, lag = c(0, 7, 14)) %>% #' step_epi_lag(case_rate, lag = c(0, 7, 14)) #' get_test_data(recipe = rec, x = case_death_rate_subset) -#' @importFrom rlang `%@%` +#' @importFrom rlang %@% #' @export get_test_data <- function( diff --git a/R/make_quantile_reg.R b/R/make_quantile_reg.R index bf17e7202..54a2360c3 100644 --- a/R/make_quantile_reg.R +++ b/R/make_quantile_reg.R @@ -49,7 +49,10 @@ quantile_reg <- function(mode = "regression", engine = "rq", quantile_levels = 0 } make_quantile_reg <- function() { - parsnip::set_new_model("quantile_reg") + current_env <- get_model_env() + if (!any(current_env$models == "quantile_reg")) { + parsnip::set_new_model("quantile_reg") + } parsnip::set_model_mode("quantile_reg", "regression") diff --git a/R/make_smooth_quantile_reg.R b/R/make_smooth_quantile_reg.R index ab2087dbb..4342c04a1 100644 --- a/R/make_smooth_quantile_reg.R +++ b/R/make_smooth_quantile_reg.R @@ -111,7 +111,10 @@ smooth_quantile_reg <- function( make_smooth_quantile_reg <- function() { - parsnip::set_new_model("smooth_quantile_reg") + current_env <- get_model_env() + if (!any(current_env$models == "smooth_quantile_reg")) { + parsnip::set_new_model("smooth_quantile_reg") + } parsnip::set_model_mode("smooth_quantile_reg", "regression") parsnip::set_model_engine("smooth_quantile_reg", "regression", eng = "smoothqr") parsnip::set_dependency( From 52f6dd1dace29fcf3af91bba8f089f3049493619 Mon Sep 17 00:00:00 2001 From: dsweber2 Date: Wed, 17 Jan 2024 17:14:22 -0800 Subject: [PATCH 2/2] Rprofile unneeded, style --- .Rprofile | 11 ----------- R/make_quantile_reg.R | 4 ++-- R/make_smooth_quantile_reg.R | 4 ++-- 3 files changed, 4 insertions(+), 15 deletions(-) delete mode 100644 .Rprofile diff --git a/.Rprofile b/.Rprofile deleted file mode 100644 index 172816a78..000000000 --- a/.Rprofile +++ /dev/null @@ -1,11 +0,0 @@ -# to load_all or document, you must first run devtools::unload("parsnip") - -load_all <- function() { - if (R.utils::isPackageLoaded("parsnip")) devtools::unload("parsnip") - devtools::load_all() -} - -document <- function() { - if (R.utils::isPackageLoaded("parsnip")) devtools::unload("parsnip") - devtools::document() -} diff --git a/R/make_quantile_reg.R b/R/make_quantile_reg.R index 54a2360c3..832ef50f8 100644 --- a/R/make_quantile_reg.R +++ b/R/make_quantile_reg.R @@ -49,8 +49,8 @@ quantile_reg <- function(mode = "regression", engine = "rq", quantile_levels = 0 } make_quantile_reg <- function() { - current_env <- get_model_env() - if (!any(current_env$models == "quantile_reg")) { + model_env <- get_model_env() + if (!("quantile_reg" %in% model_env$models)) { parsnip::set_new_model("quantile_reg") } parsnip::set_model_mode("quantile_reg", "regression") diff --git a/R/make_smooth_quantile_reg.R b/R/make_smooth_quantile_reg.R index 4342c04a1..9ab3a366b 100644 --- a/R/make_smooth_quantile_reg.R +++ b/R/make_smooth_quantile_reg.R @@ -111,8 +111,8 @@ smooth_quantile_reg <- function( make_smooth_quantile_reg <- function() { - current_env <- get_model_env() - if (!any(current_env$models == "smooth_quantile_reg")) { + model_env <- get_model_env() + if (!("smooth_quantile_reg" %in% model_env$models)) { parsnip::set_new_model("smooth_quantile_reg") } parsnip::set_model_mode("smooth_quantile_reg", "regression")