Skip to content

Commit 6c3ba35

Browse files
committed
glue->paste, dropping zoo
1 parent 2f0305e commit 6c3ba35

12 files changed

+32
-31
lines changed

DESCRIPTION

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ Imports:
4646
tidyselect,
4747
tsibble,
4848
vctrs,
49-
workflows (>= 1.0.0),
50-
zoo
49+
workflows (>= 1.0.0)
5150
Suggests:
5251
covidcast,
5352
data.table,

R/epi_check_training_set.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ epi_check_training_set <- function(x, rec) {
1616
if (!is.null(old_ok)) {
1717
if (all(old_ok %in% colnames(x))) { # case 1
1818
if (!all(old_ok %in% new_ok)) {
19-
cli::cli_warn(c(
19+
cli::cli_warn(paste(
2020
"The recipe specifies additional keys. Because these are available,",
2121
"they are being added to the metadata of the training data."
2222
))

R/epi_recipe.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ epi_recipe.epi_df <-
9494
## Check and add roles when available
9595
if (!is.null(roles)) {
9696
if (length(roles) != length(vars)) {
97-
cli::cli_abort(c(
97+
cli::cli_abort(paste(
9898
"The number of roles should be the same as the number of ",
9999
"variables."
100100
))
@@ -456,7 +456,7 @@ prep.epi_recipe <- function(
456456
}
457457
skippers <- map_lgl(x$steps, recipes:::is_skipable)
458458
if (any(skippers) & !retain) {
459-
cli::cli_warn(c(
459+
cli::cli_warn(paste(
460460
"Since some operations have `skip = TRUE`, using ",
461461
"`retain = TRUE` will allow those steps results to ",
462462
"be accessible."

R/frosting.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ apply_frosting.epi_workflow <-
370370
}
371371

372372
if (!has_postprocessor_frosting(workflow)) {
373-
cli::cli_warn(c(
373+
cli::cli_warn(paste(
374374
"Only postprocessors of class {.cls frosting} are allowed.",
375375
"Returning unpostprocessed predictions."
376376
))

R/layer_cdc_flatline_quantiles.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,15 +177,15 @@ slather.layer_cdc_flatline_quantiles <-
177177
if (length(object$by_key) > 0L) {
178178
cols_in_preds <- hardhat::check_column_names(p, object$by_key)
179179
if (!cols_in_preds$ok) {
180-
cli::cli_warn(c(
180+
cli::cli_warn(paste(
181181
"Predicted values are missing key columns: {.val {cols_in_preds$missing_names}}.",
182182
"Ignoring these."
183183
))
184184
}
185185
if (inherits(the_fit, "_flatline")) {
186186
cols_in_resids <- hardhat::check_column_names(r, object$by_key)
187187
if (!cols_in_resids$ok) {
188-
cli::cli_warn(c(
188+
cli::cli_warn(paste(
189189
"Existing residuals are missing key columns: {.val {cols_in_resids$missing_names}}.",
190190
"Ignoring these."
191191
))
@@ -202,7 +202,7 @@ slather.layer_cdc_flatline_quantiles <-
202202
)
203203
cols_in_resids <- hardhat::check_column_names(key_cols, object$by_key)
204204
if (!cols_in_resids$ok) {
205-
cli::cli_warn(c(
205+
cli::cli_warn(paste(
206206
"Requested residuals are missing key columns: {.val {cols_in_resids$missing_names}}.",
207207
"Ignoring these."
208208
))

R/layer_residual_quantiles.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ slather.layer_residual_quantiles <-
9393
common <- intersect(object$by_key, names(key_cols))
9494
excess <- setdiff(object$by_key, names(key_cols))
9595
if (length(excess) > 0L) {
96-
cli::cli_warn(c(
96+
cli::cli_warn(paste(
9797
"Requested residual grouping key(s) {.val {excess}} are unavailable ",
9898
"in the original data. Grouping by the remainder: {.val {common}}."
9999
))
@@ -104,7 +104,7 @@ slather.layer_residual_quantiles <-
104104
if (length(common_in_r) == length(common)) {
105105
r <- dplyr::left_join(key_cols, r, by = common_in_r)
106106
} else {
107-
cli::cli_warn(c(
107+
cli::cli_warn(paste(
108108
"Some grouping keys are not in data.frame returned by the",
109109
"`residuals()` method. Groupings may not be correct."
110110
))
@@ -159,7 +159,7 @@ grab_residuals <- function(the_fit, components) {
159159
} else if (is.vector(drop(r))) { # also success
160160
return(tibble(.resid = drop(r)))
161161
} else { # failure
162-
cli::cli_warn(c(
162+
cli::cli_warn(paste(
163163
"The `residuals()` method for objects of class {.cls {cl}} results in an",
164164
"object that is neither a data frame with a column named `.resid`,",
165165
"nor something coercible to a vector.",

R/pivot_quantiles.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pivot_quantiles_longer <- function(.data, ..., .ignore_length_check = FALSE) {
7474
tidyr::unnest(tidyselect::all_of(col), names_sep = "_")
7575
}
7676
} else {
77-
cli::cli_abort(c(
77+
cli::cli_abort(paste(
7878
"Some selected columns contain different numbers of quantiles.",
7979
"The result would be a {.emph very} long {.cls tibble}.",
8080
"To do this anyway, rerun with `.ignore_length_check = TRUE`."

R/step_adjust_latency.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ step_adjust_latency <-
119119
recipe$steps,
120120
function(recipe_step) inherits(recipe_step, rel_step_type)
121121
))) {
122-
cli::cli_abort(glue::glue(
122+
cli::cli_abort(paste(
123123
"There is no `{rel_step_type}` defined before this.",
124124
" For the method `extend_{shift_name}` of `step_adjust_latency`,",
125125
" at least one {shift_name} must be previously defined."
@@ -168,13 +168,13 @@ step_adjust_latency_new <-
168168
#' @export
169169
prep.step_adjust_latency <- function(x, training, info = NULL, ...) {
170170
if ((x$method == "extend_ahead") && (!("outcome" %in% info$role))) {
171-
cli::cli_abort(glue::glue(
172-
"If `method` is `\"extend_ahead\"`, then a step ",
171+
cli::cli_abort(paste(
172+
"If `method` is {.val extend_ahead}, then a step ",
173173
"must have already added an outcome."
174174
))
175175
} else if (!("predictor" %in% info$role)) {
176-
cli::cli_abort(glue::glue(
177-
"If `method` is `\"extend_lags\"` or `\"locf\"`, then a step ",
176+
cli::cli_abort(paste(
177+
"If `method` is {.val extend_lags} or {.val locf}, then a step ",
178178
"must have already added a predictor."
179179
))
180180
}
@@ -210,8 +210,8 @@ prep.step_adjust_latency <- function(x, training, info = NULL, ...) {
210210
((time_type == "yearquarter") && (latency >= 1)) ||
211211
((time_type == "year") && (latency >= 1))
212212
) {
213-
cli::cli_warn(c(
214-
"!" = glue::glue(
213+
cli::cli_warn(paste(
214+
"!" = paste(
215215
"The shift has been adjusted by {latency}, ",
216216
"which is questionable for it's `time_type` of ",
217217
"{time_type}"

R/utils-latency.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#' offset each relevant column by it's appropriate latency
22
#' works for either adjusting aheads or lags
3+
#' note that this may introduce new NA values when one column is shifted farther than another
34
#' @param shift_cols a tibble which must have the columns `column`, the name of
45
#' the column to adjust, `latency` the latency of the original column relative
56
#' to the `as_of` date, `new_name`, the names in `column` adjusted by the
@@ -20,7 +21,6 @@ extend_either <- function(new_data, shift_cols, keys) {
2021
key_cols = keys
2122
)
2223
}) %>%
23-
map(function(x) zoo::na.trim(x)) %>%
2424
reduce(
2525
dplyr::full_join,
2626
by = keys
@@ -146,21 +146,21 @@ set_asof <- function(new_data, info) {
146146
max_time <- max(time_values)
147147
# make sure the as_of is sane
148148
if (!inherits(as_of, class(time_values)) & !inherits(as_of, "POSIXt")) {
149-
cli::cli_abort(glue::glue(
149+
cli::cli_abort(paste(
150150
"the data matrix `as_of` value is {as_of}, ",
151151
"and not a valid `time_type` with type ",
152152
"matching `time_value`'s type of ",
153153
"{typeof(new_data$time_value)}."
154154
))
155155
}
156156
if (is.null(as_of) || is.na(as_of)) {
157-
cli::cli_warn(glue::glue(
157+
cli::cli_warn(paste(
158158
"epi_data's `as_of` was {as_of}, setting to ",
159159
"the latest time value, {max_time}."
160160
))
161161
as_of <- max_time
162162
} else if (as_of < max_time) {
163-
cli::cli_abort(glue::glue(
163+
cli::cli_abort(paste(
164164
"`as_of` ({(as_of)}) is before the most ",
165165
"recent data ({max_time}). Remove before ",
166166
"predicting."

R/utils-misc.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ grab_forged_keys <- function(forged, mold, new_data) {
4343
# 3. these are the keys in the test data as input
4444
new_df_keys <- epi_keys(new_data, extra_keys = setdiff(new_keys, keys[1:2]))
4545
if (!(setequal(old_keys, new_df_keys) && setequal(new_keys, new_df_keys))) {
46-
cli::cli_warn(c(
46+
cli::cli_warn(paste(
4747
"Not all epi keys that were present in the training data are available",
4848
"in `new_data`. Predictions will have only the available keys."
4949
))

R/utils-shift.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ adjust_latency <- function(object, new_data) {
1212
} else if (method == "extend_ahead") {
1313
as_of <- attributes(new_data)$metadata$as_of
1414
if (FALSE && (typeof(as_of) != typeof(new_data$time_value))) {
15-
cli::cli_abort(glue::glue(
15+
cli::cli_abort(paste(
1616
"the data matrix `as_of` value is {as_of}, ",
1717
"and not a valid `time_type` with type ",
1818
"matching `time_value`'s type of ",
@@ -27,13 +27,13 @@ adjust_latency <- function(object, new_data) {
2727
max_time <- max(time_values)
2828
shift_amount <- as.Date(as_of) - max_time
2929
if (is.null(as_of) || is.na(as_of)) {
30-
cli::cli_warn(glue::glue(
30+
cli::cli_warn(paste(
3131
"epi_data's `as_of` was {as_of}, setting to ",
3232
"the latest time value, {max_time}."
3333
))
3434
as_of <- max_time
3535
} else if (as_of < max_time) {
36-
cli::cli_abort(glue::glue(
36+
cli::cli_abort(paste(
3737
"`as_of` ({(as_of)}) is before the most ",
3838
"recent data ({max_time}). Remove before ",
3939
"predicting."
@@ -47,7 +47,7 @@ adjust_latency <- function(object, new_data) {
4747
((time_type == "yearmonth") && (shift_amount >= 2)) ||
4848
((time_type == "yearquarter") && (shift_amount >= 1)) ||
4949
((time_type == "year") && (shift_amount >= 1))) {
50-
cli::cli_warn(c(
50+
cli::cli_warn(paste(
5151
"!" = glue::glue(
5252
"The ahead has been adjusted by {shift_amount}, ",
5353
"which is questionable for it's `time_type` of ",
@@ -63,7 +63,7 @@ adjust_latency <- function(object, new_data) {
6363
cli::cli_abort("the `time_value` column of `new_data` is empty")
6464
}
6565
} else {
66-
cli::cli_abort(glue::glue(
66+
cli::cli_abort(paste(
6767
"Latency adjustment method {method} has not yet ",
6868
"been implemented for `step_epi_ahead`."
6969
))

man/extend_either.Rd

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)