Skip to content

Commit ce99138

Browse files
committed
only adding metadata if given an epi_df originally
1 parent 90edb46 commit ce99138

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

.Rbuildignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@
2020
^doc$
2121
^Meta$
2222
^.lintr$
23-
^.venv$
23+
^.venv$
24+
^inst/templates$

R/epi_shift.R

+9-4
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,14 @@ add_shifted_columns <- function(new_data, object) {
6060
processed <- new_data %>%
6161
full_join(shifted, by = ok) %>%
6262
group_by(across(all_of(kill_time_value(ok)))) %>%
63-
arrange(time_value) %>%
64-
ungroup() %>%
65-
as_epi_df()
66-
attributes(processed)$metadata <- attributes(new_data)$metadata
63+
arrange(time_value)
64+
if (inherits(new_data, "epi_df")) {
65+
processed <- processed %>%
66+
ungroup() %>%
67+
as_epi_df(
68+
as_of = attributes(new_data)$metadata$as_of,
69+
other_keys = attributes(new_data)$metadata$other_keys
70+
)
71+
}
6772
return(processed)
6873
}

R/step_epi_shift.R

-2
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,6 @@ prep.step_epi_ahead <- function(x, training, info = NULL, ...) {
248248

249249
#' @export
250250
bake.step_epi_lag <- function(object, new_data, ...) {
251-
names(object)
252-
object$shift_grid
253251
add_shifted_columns(new_data, object)
254252
}
255253

0 commit comments

Comments
 (0)