From 76dcec9e1ccfdd12ca6cce8ec56bc296ea9ea4e4 Mon Sep 17 00:00:00 2001 From: Tom Elliott Date: Tue, 23 Jul 2024 09:05:58 +1200 Subject: [PATCH 1/2] fix missing log_if when pkg not loaded --- DESCRIPTION | 2 +- NEWS.md | 4 ++++ R/forecastplot.R | 3 +-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index a963704..3216ae7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: iNZightTS Type: Package Title: Time Series for 'iNZight' -Version: 2.0.0 +Version: 2.0.1 Authors@R: c( person("Tom", "Elliott", role = c("aut", "cre"), email = "tom.elliott@auckland.ac.nz", comment = c(ORCID = "0000-0002-7815-6318")), person("Zhaoming", "Su", role = "aut"), diff --git a/NEWS.md b/NEWS.md index 89a4c9b..e6e4bdf 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# iNZightTS 2.0.1 + +- prefix `log_if` with `iNZightTS::` so 'fabletools' can find it if the package is not loaded with `library()` + # iNZightTS 2.0.0 Large update with major refactoring of most/all plots and processes. Notably, diff --git a/R/forecastplot.R b/R/forecastplot.R index de12f4c..0875059 100644 --- a/R/forecastplot.R +++ b/R/forecastplot.R @@ -20,7 +20,6 @@ #' #' @export #' @md - log_if <- fabletools::new_transformation( transformation = function(x, mult_fit) { if (mult_fit) log(x) else as.numeric(x) @@ -210,7 +209,7 @@ use_urca <- function() { predict_inzightts_var <- function(x, var, h, mult_fit, pred_model, confint_width) { - fit <- fabletools::model(x, Prediction = pred_model(log_if(!!var, !!mult_fit))) + fit <- fabletools::model(x, Prediction = pred_model(iNZightTS::log_if(!!var, !!mult_fit))) fit |> fabletools::forecast(h = h) |> dplyr::mutate( From d7b4840e1193c9e632e6d428eb7644006a35e151 Mon Sep 17 00:00:00 2001 From: Tom Elliott Date: Fri, 6 Sep 2024 12:49:11 +1200 Subject: [PATCH 2/2] format --- R/forecastplot.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/R/forecastplot.R b/R/forecastplot.R index 0875059..e3f9992 100644 --- a/R/forecastplot.R +++ b/R/forecastplot.R @@ -209,7 +209,9 @@ use_urca <- function() { predict_inzightts_var <- function(x, var, h, mult_fit, pred_model, confint_width) { - fit <- fabletools::model(x, Prediction = pred_model(iNZightTS::log_if(!!var, !!mult_fit))) + fit <- fabletools::model(x, + Prediction = pred_model(log_if(!!var, !!mult_fit)) + ) fit |> fabletools::forecast(h = h) |> dplyr::mutate(