Skip to content

Commit 2f0305e

Browse files
committed
rec formatting things, dropping purrr
1 parent a4a33db commit 2f0305e

9 files changed

+24
-17
lines changed

DESCRIPTION

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ Imports:
3939
quantreg,
4040
recipes (>= 1.0.4),
4141
rlang (>= 1.0.0),
42-
purrr,
4342
smoothqr,
4443
stats,
4544
tibble,

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ importFrom(ggplot2,autoplot)
239239
importFrom(hardhat,refresh_blueprint)
240240
importFrom(hardhat,run_mold)
241241
importFrom(magrittr,"%>%")
242-
importFrom(purrr,map_lgl)
243242
importFrom(quantreg,rq)
244243
importFrom(recipes,bake)
245244
importFrom(recipes,prep)

R/arx_classifier.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ arx_class_epi_workflow <- function(
119119
args_list = arx_class_args_list()) {
120120
validate_forecaster_inputs(epi_data, outcome, predictors)
121121
if (!inherits(args_list, c("arx_class", "alist"))) {
122-
cli::cli_abort("args_list was not created using `arx_class_args_list().")
122+
cli::cli_abort("`args_list` was not created using `arx_class_args_list().`")
123123
}
124124
if (!(is.null(trainer) || is_classification(trainer))) {
125-
cli::cli_abort("`trainer` must be a `{parsnip}` model of mode 'classification'.")
125+
cli::cli_abort("`trainer` must be a `{.pkg parsnip}` model of mode 'classification'.")
126126
}
127127
lags <- arx_lags_validator(predictors, args_list$lags)
128128

R/epi_workflow.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ augment.epi_workflow <- function(x, new_data, ...) {
189189
} else {
190190
cli::cli_abort(
191191
c(
192-
"Cannot determine how to join new_data with the predictions.",
193-
"Try converting new_data to an epi_df with `as_epi_df(new_data)`."
192+
"Cannot determine how to join `new_data` with the `predictions`.",
193+
"Try converting `new_data` to an {.cls epi_df} with `as_epi_df(new_data)`."
194194
)
195195
)
196196
}

R/step_adjust_latency.R

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ step_adjust_latency <-
9191
id = recipes::rand_id("epi_lag")) {
9292
arg_is_chr_scalar(id, method)
9393
if (!is_epi_recipe(recipe)) {
94-
cli::cli_abort("This recipe step can only operate on an `epi_recipe`.")
94+
cli::cli_abort("This recipe step can only operate on an {.cls epi_recipe}.")
9595
}
9696
if (!is.null(columns)) {
9797
cli::cli_abort(c("The `columns` argument must be `NULL`.",
@@ -119,7 +119,11 @@ step_adjust_latency <-
119119
recipe$steps,
120120
function(recipe_step) inherits(recipe_step, rel_step_type)
121121
))) {
122-
cli:cli_abort("there is no `{rel_step_type}` defined before this. for the method `extend_{shift_name}` of `step_adjust_latency`, at least one {shift_name} must be previously defined.")
122+
cli::cli_abort(glue::glue(
123+
"There is no `{rel_step_type}` defined before this.",
124+
" For the method `extend_{shift_name}` of `step_adjust_latency`,",
125+
" at least one {shift_name} must be previously defined."
126+
))
123127
}
124128

125129
recipes::add_step(
@@ -164,11 +168,15 @@ step_adjust_latency_new <-
164168
#' @export
165169
prep.step_adjust_latency <- function(x, training, info = NULL, ...) {
166170
if ((x$method == "extend_ahead") && (!("outcome" %in% info$role))) {
167-
cli::cli_abort('If `method` is `"extend_ahead"`, then a step ",
168-
"must have already added an outcome .')
171+
cli::cli_abort(glue::glue(
172+
"If `method` is `\"extend_ahead\"`, then a step ",
173+
"must have already added an outcome."
174+
))
169175
} else if (!("predictor" %in% info$role)) {
170-
cli::cli_abort('If `method` is `"extend_lags"` or `"locf"`, then a step ",
171-
"must have already added a predictor.')
176+
cli::cli_abort(glue::glue(
177+
"If `method` is `\"extend_lags\"` or `\"locf\"`, then a step ",
178+
"must have already added a predictor."
179+
))
172180
}
173181

174182
# get the columns used, even if it's all of them

R/step_growth_rate.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ step_growth_rate <-
5656
id = rand_id("growth_rate"),
5757
additional_gr_args_list = list()) {
5858
if (!is_epi_recipe(recipe)) {
59-
cli::cli_abort("This recipe step can only operate on an `epi_recipe`.")
59+
cli::cli_abort("This recipe step can only operate on an {.cls epi_recipe}.")
6060
}
6161
method <- match.arg(method)
6262
arg_is_pos_int(horizon)
6363
arg_is_scalar(horizon)
6464
if (!is.null(replace_Inf)) {
65-
if (length(replace_Inf) != 1L) cli::cli_abort("replace_Inf must be a scalar.")
65+
if (length(replace_Inf) != 1L) cli::cli_abort("`replace_Inf` must be a scalar.")
6666
if (!is.na(replace_Inf)) arg_is_numeric(replace_Inf)
6767
}
6868
arg_is_chr(role)

R/step_lag_difference.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ step_lag_difference <-
3333
skip = FALSE,
3434
id = rand_id("lag_diff")) {
3535
if (!is_epi_recipe(recipe)) {
36-
cli::cli_abort("This recipe step can only operate on an `epi_recipe`.")
36+
cli::cli_abort("This recipe step can only operate on an {.cls epi_recipe}.")
3737
}
3838
arg_is_pos_int(horizon)
3939
arg_is_chr(role)

R/utils-latency.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ construct_shift_tibble <- function(terms_used, recipe, rel_step_type, shift_name
6868
#' been changed
6969
#' @param shift_cols a list of columns to operate on, as created by `construct_shift_tibble`
7070
#' @param new_data the data transformed so far
71-
#' @param as_of
71+
#' @param as_of the forecast date
7272
#' @param latency `NULL`, int, or vector, as described in `step_eip_latency`
7373
#' @param sign_shift -1 if ahead, 1 if lag
7474
#' @return a tibble with columns `column` (relevant shifted names), `shift` (the
@@ -78,7 +78,6 @@ construct_shift_tibble <- function(terms_used, recipe, rel_step_type, shift_name
7878
#' effective_shift)
7979
#' @keywords internal
8080
#' @importFrom dplyr rowwise %>%
81-
#' @importFrom purrr map_lgl
8281
get_latent_column_tibble <- function(
8382
shift_cols, new_data, as_of, latency,
8483
sign_shift, info, call = caller_env()) {

man/get_latent_column_tibble.Rd

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)