@@ -291,23 +291,22 @@ epi_slide <- function(x, f, ..., before, after, ref_time_values,
291
291
292
292
key_cols_no_time <- kill_time_value(key_cols )
293
293
294
- # `complete` strips epi_df format and metadata. Restore them.
295
- x <- bind_rows(
296
- x [c(),],
297
- # Add in rows for each present key column combination for all dates.
298
- # - This happens within each group if the data is grouped. This
299
- # doesn't change the impact of completion because we apply the
300
- # computation by group as well.
301
- # - If a geo first appears halfway through the dataset, it will be
302
- # completed all the way back to the beginning of the data.
303
- tidyr :: complete(x ,
294
+ # Add in rows for each present key column combination for all dates.
295
+ # - This happens within each group if the data is grouped. This
296
+ # doesn't change the impact of completion because we apply the
297
+ # computation by group as well.
298
+ # - If a geo first appears halfway through the dataset, it will be
299
+ # completed all the way back to the beginning of the data.
300
+ x <- tidyr :: complete(x ,
304
301
expand(x , nesting(!! key_cols_no_time ), data.frame (time_value = all_dates )),
305
302
# `complete` checks that fill types match existing column types.
306
303
fill = fill ,
307
304
# Existing missings will be replaced by `fill`, too.
308
305
explicit = TRUE
309
306
)
310
- )
307
+
308
+ # `complete` strips epi_df format and metadata. Restore them.
309
+ x <- reclass(x , attributes(x )$ metadata )
311
310
}
312
311
313
312
# If a custom time step is specified, then redefine units
0 commit comments