Skip to content

Commit fc0e99c

Browse files
committed
styler
1 parent d15f800 commit fc0e99c

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

R/get_test_data.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ pad_to_end <- function(x, groups, end_date) {
162162
}
163163

164164
Seq <- function(from, to, by) {
165-
if (from > to) return(NULL)
165+
if (from > to) {
166+
return(NULL)
167+
}
166168
seq(from = from, to = to, by = by)
167169
}

R/step_epi_slide.R

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ step_epi_slide_new <-
139139

140140
#' @export
141141
prep.step_epi_slide <- function(x, training, info = NULL, ...) {
142-
143142
col_names <- recipes::recipes_eval_select(x$terms, data = training, info = info)
144143

145144
check_type(training[, col_names], types = c("double", "integer"))
@@ -164,7 +163,6 @@ prep.step_epi_slide <- function(x, training, info = NULL, ...) {
164163

165164
#' @export
166165
bake.step_epi_slide <- function(object, new_data, ...) {
167-
168166
recipes::check_new_data(names(object$columns), object, new_data)
169167
col_names <- object$columns
170168
name_prefix <- paste0(object$prefix, object$f_name, "_")
@@ -176,7 +174,8 @@ bake.step_epi_slide <- function(object, new_data, ...) {
176174
nms <- new_data_names[intersection]
177175
cli_abort(
178176
c("Name collision occured. The following variable names already exist:",
179-
`*` = "{.var {nms}}"),
177+
`*` = "{.var {nms}}"
178+
),
180179
call = caller_env()
181180
)
182181
}
@@ -191,7 +190,8 @@ bake.step_epi_slide <- function(object, new_data, ...) {
191190
dplyr::across(
192191
dplyr::all_of(object$columns),
193192
~ slider::slide_index_vec(
194-
.x, .i = time_value,
193+
.x,
194+
.i = time_value,
195195
object$.f, .before = object$before, .after = object$after
196196
)
197197
)
@@ -270,7 +270,7 @@ validate_slide_fun <- function(.f) {
270270
try_period <- function(x) {
271271
err <- is.na(x)
272272
if (!err) {
273-
if (is.numeric(x) ) {
273+
if (is.numeric(x)) {
274274
err <- !rlang::is_integerish(x) || x < 0
275275
} else {
276276
x <- lubridate::as.period(x)
@@ -279,12 +279,10 @@ try_period <- function(x) {
279279
}
280280
if (err) {
281281
cli_abort(paste(
282-
'The value supplied to `before` or `after` must be a non-negative integer',
283-
'a {.cls lubridate::period} or a character scalar that can be coerced',
282+
"The value supplied to `before` or `after` must be a non-negative integer",
283+
"a {.cls lubridate::period} or a character scalar that can be coerced",
284284
'as a {.cls lubridate::period}, e.g., `"1 week"`.'
285-
),
286-
)
285+
), )
287286
}
288287
x
289288
}
290-

tests/testthat/test-step_epi_slide.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ rolled_after <- edf %>%
5555

5656

5757
test_that("epi_slide handles classed before/after", {
58-
5958
baseline <- r %>%
6059
step_epi_slide(value, .f = mean, before = 3L) %>%
6160
prep(edf) %>%

0 commit comments

Comments
 (0)