From 0bd09ca231c7d74a10ed44f32bb2d4cdc056940d Mon Sep 17 00:00:00 2001 From: Mitch Date: Sun, 17 Jan 2021 21:20:25 +1100 Subject: [PATCH] Add progress reporting to model() docs --- R/model.R | 7 +++++++ man/model.Rd | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/R/model.R b/R/model.R index 73685cf8..726626f8 100644 --- a/R/model.R +++ b/R/model.R @@ -29,6 +29,11 @@ model <- function(.data, ...){ #' [`future::plan()`] before estimating the models, they will be computed #' according to that plan. #' +#' @section Progress: +#' +#' Progress on model estimation can be obtained by wrapping the code with +#' `progressr::with_progress()`. Further customisation on how progress is +#' reported can be controlled using the `progressr` package. #' #' @examples #' if (requireNamespace("fable", quietly = TRUE) && requireNamespace("tsibbledata", quietly = TRUE)) { @@ -42,6 +47,7 @@ model <- function(.data, ...){ #' # Training a seasonal naive and ETS(A,A,A) model to the monthly #' # "Food retailing" turnover for selected Australian states. #' library(dplyr) +#' progressr::with_progress( #' aus_retail %>% #' filter( #' Industry == "Food retailing", @@ -51,6 +57,7 @@ model <- function(.data, ...){ #' snaive = SNAIVE(Turnover), #' ets = ETS(log(Turnover) ~ error("A") + trend("A") + season("A")), #' ) +#' ) #' } #' #' @export diff --git a/man/model.Rd b/man/model.Rd index ce12b159..8365fe4d 100644 --- a/man/model.Rd +++ b/man/model.Rd @@ -35,6 +35,14 @@ It is possible to estimate models in parallel using the according to that plan. } +\section{Progress}{ + + +Progress on model estimation can be obtained by wrapping the code with +\code{progressr::with_progress()}. Further customisation on how progress is +reported can be controlled using the \code{progressr} package. +} + \examples{ if (requireNamespace("fable", quietly = TRUE) && requireNamespace("tsibbledata", quietly = TRUE)) { library(fable) @@ -47,6 +55,7 @@ aus_production \%>\% # Training a seasonal naive and ETS(A,A,A) model to the monthly # "Food retailing" turnover for selected Australian states. library(dplyr) +progressr::with_progress( aus_retail \%>\% filter( Industry == "Food retailing", @@ -56,6 +65,7 @@ aus_retail \%>\% snaive = SNAIVE(Turnover), ets = ETS(log(Turnover) ~ error("A") + trend("A") + season("A")), ) +) } }