@@ -104,7 +104,7 @@ time_slide_to_simple_hop <- function(.slide_comp, ..., .before_n_steps, .after_n
104104# ' @keywords internal
105105upstream_slide_to_simple_hop <- function (.f , ... , .in_colnames , .out_colnames , .before_n_steps , .after_n_steps ) {
106106 f_info <- upstream_slide_f_info(.f , ... )
107- in_colnames <- .in_colnames
107+ in_colnames <- .in_colnames # TODO refactor away
108108 out_colnames <- .out_colnames
109109 f_from_package <- f_info $ from_package
110110 switch (f_from_package ,
@@ -113,7 +113,9 @@ upstream_slide_to_simple_hop <- function(.f, ..., .in_colnames, .out_colnames, .
113113 stop(" .before_n_steps only supported with .after_n_steps = 0" )
114114 }
115115 function (grp_data , grp_key , ref_inds ) {
116- .f(x = grp_data [, in_colnames ], n = seq_len(nrow(grp_data )), adaptive = TRUE , ... )
116+ out_cols <- .f(x = grp_data [, in_colnames ], n = seq_len(nrow(grp_data )), adaptive = TRUE , ... )
117+ names(out_cols ) <- out_colnames
118+ vec_slice(new_tibble(out_cols , nrow = nrow(grp_data )), ref_inds )
117119 }
118120 } else {
119121 function (grp_data , grp_key , ref_inds ) {
@@ -126,16 +128,18 @@ upstream_slide_to_simple_hop <- function(.f, ..., .in_colnames, .out_colnames, .
126128 c(out_col [(.after_n_steps + 1L ): length(out_col )], rep(NA , .after_n_steps ))
127129 })
128130 }
129- out_cols
131+ names(out_cols ) <- out_colnames
132+ vec_slice(new_tibble(out_cols , nrow = nrow(grp_data )), ref_inds )
130133 }
131134 },
132135 slider =
133136 # TODO Inf checks?
134137 function (grp_data , grp_key , ref_inds ) {
135- names(in_colnames ) <- in_colnames
136- lapply(in_colnames , function (in_colname ) {
138+ out_cols <- lapply(in_colnames , function (in_colname ) {
137139 .f(x = grp_data [[in_colname ]], before = .before_n_steps , after = .after_n_steps , ... )
138140 })
141+ names(out_cols ) <- out_colnames
142+ vec_slice(new_tibble(out_cols , nrow = nrow(grp_data )), ref_inds )
139143 },
140144 # TODO improve message
141145 stop(" unsupported package" )
0 commit comments