Skip to content

Commit 237ec50

Browse files
committed
run styler
1 parent d6a28f3 commit 237ec50

File tree

4 files changed

+36
-35
lines changed

4 files changed

+36
-35
lines changed

R/layer_cdc_flatline_quantiles.R

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,16 @@
8383
#' geom_ribbon(aes(ymin = `0.1`, ymax = `0.9`), fill = blues9[3]) +
8484
#' geom_ribbon(aes(ymin = `0.25`, ymax = `0.75`), fill = blues9[6]) +
8585
#' geom_line(aes(y = .pred), color = "orange") +
86-
#' geom_line(data = case_death_rate_subset %>% filter(geo_value %in% four_states),
87-
#' aes(x = time_value, y = death_rate)) +
86+
#' geom_line(
87+
#' data = case_death_rate_subset %>% filter(geo_value %in% four_states),
88+
#' aes(x = time_value, y = death_rate)
89+
#' ) +
8890
#' scale_x_date(limits = c(forecast_date - 90, forecast_date + 30)) +
8991
#' labs(x = "Date", y = "Death rate") +
9092
#' facet_wrap(~geo_value, scales = "free_y") +
9193
#' theme_bw() +
9294
#' geom_vline(xintercept = forecast_date)
9395
#'
94-
#'
9596
layer_cdc_flatline_quantiles <- function(
9697
frosting,
9798
...,
@@ -102,7 +103,6 @@ layer_cdc_flatline_quantiles <- function(
102103
symmetrize = FALSE,
103104
nonneg = TRUE,
104105
id = rand_id("cdc_baseline_bands")) {
105-
106106
rlang::check_dots_empty()
107107

108108
arg_is_int(aheads)
@@ -134,8 +134,7 @@ layer_cdc_flatline_quantiles_new <- function(
134134
by_key,
135135
symmetrize,
136136
nonneg,
137-
id
138-
) {
137+
id) {
139138
layer(
140139
"cdc_flatline_quantiles",
141140
aheads = aheads,
@@ -154,8 +153,10 @@ slather.layer_cdc_flatline_quantiles <-
154153
the_fit <- workflows::extract_fit_parsnip(workflow)
155154
if (!inherits(the_fit, "_flatline")) {
156155
cli::cli_warn(
157-
c("Predictions for this workflow were not produced by the {.cls flatline}",
158-
"{.pkg parsnip} engine. Results may be unexpected. See {.fn epipredict::flatline}.")
156+
c(
157+
"Predictions for this workflow were not produced by the {.cls flatline}",
158+
"{.pkg parsnip} engine. Results may be unexpected. See {.fn epipredict::flatline}."
159+
)
159160
)
160161
}
161162
p <- components$predictions
@@ -240,8 +241,11 @@ propogate_samples <- function(
240241
for (iter in 2:max_ahead) {
241242
samp <- shuffle(samp)
242243
raw <- raw + samp
243-
if (symmetrize) symmetric <- raw - (median(raw) - p)
244-
else symmetric <- raw
244+
if (symmetrize) {
245+
symmetric <- raw - (median(raw) - p)
246+
} else {
247+
symmetric <- raw
248+
}
245249
if (nonneg) symmetric <- pmax(0, symmetric)
246250
res[[iter]] <- symmetric
247251
}

R/step_growth_rate.R

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,19 @@
4242
#' recipes::prep() %>%
4343
#' recipes::bake(case_death_rate_subset)
4444
step_growth_rate <-
45-
function(
46-
recipe,
47-
...,
48-
role = "predictor",
49-
trained = FALSE,
50-
horizon = 7,
51-
method = c("rel_change", "linear_reg", "smooth_spline", "trend_filter"),
52-
log_scale = FALSE,
53-
replace_Inf = NA,
54-
prefix = "gr_",
55-
columns = NULL,
56-
skip = FALSE,
57-
id = rand_id("growth_rate"),
58-
additional_gr_args_list = list()) {
45+
function(recipe,
46+
...,
47+
role = "predictor",
48+
trained = FALSE,
49+
horizon = 7,
50+
method = c("rel_change", "linear_reg", "smooth_spline", "trend_filter"),
51+
log_scale = FALSE,
52+
replace_Inf = NA,
53+
prefix = "gr_",
54+
columns = NULL,
55+
skip = FALSE,
56+
id = rand_id("growth_rate"),
57+
additional_gr_args_list = list()) {
5958
if (!is_epi_recipe(recipe)) {
6059
rlang::abort("This recipe step can only operate on an `epi_recipe`.")
6160
}

R/step_lag_difference.R

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,15 @@
2323
#' recipes::prep() %>%
2424
#' recipes::bake(case_death_rate_subset)
2525
step_lag_difference <-
26-
function(
27-
recipe,
28-
...,
29-
role = "predictor",
30-
trained = FALSE,
31-
horizon = 7,
32-
prefix = "lag_diff_",
33-
columns = NULL,
34-
skip = FALSE,
35-
id = rand_id("lag_diff")) {
26+
function(recipe,
27+
...,
28+
role = "predictor",
29+
trained = FALSE,
30+
horizon = 7,
31+
prefix = "lag_diff_",
32+
columns = NULL,
33+
skip = FALSE,
34+
id = rand_id("lag_diff")) {
3635
if (!is_epi_recipe(recipe)) {
3736
rlang::abort("This recipe step can only operate on an `epi_recipe`.")
3837
}

tests/testthat/test-propogate_samples.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ test_that("propogate_samples", {
44
quantiles <- 1:9 / 10
55
aheads <- c(2, 4, 7)
66
nsim <- 100
7-
87
})

0 commit comments

Comments
 (0)