Skip to content

Commit 2aa5631

Browse files
committed
make sure that incoming data is always an epi_df
1 parent 800e22a commit 2aa5631

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

R/step_epi_slide.R

+4-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ prep.step_epi_slide <- function(x, training, info = NULL, ...) {
140140

141141
#' @export
142142
bake.step_epi_slide <- function(object, new_data, ...) {
143-
recipes::check_new_data(names(object$columns), object, new_data)
144143
col_names <- object$columns
145144
name_prefix <- paste0(object$prefix, object$f_name, "_")
146145
newnames <- glue::glue("{name_prefix}{col_names}")
@@ -157,6 +156,10 @@ bake.step_epi_slide <- function(object, new_data, ...) {
157156
class = "epipredict__step__name_collision_error"
158157
)
159158
}
159+
# make sure that new_data is actually an epi_df
160+
if (!inherits(new_data, "epi_df")) {
161+
new_data <- new_data %>% as_epi_df()
162+
}
160163
# TODO: Uncomment this whenever we make the optimized versions available.
161164
# if (any(vapply(c(mean, sum), \(x) identical(x, object$.f), logical(1L)))) {
162165
# cli_warn(

0 commit comments

Comments
 (0)