@@ -104,7 +104,7 @@ time_slide_to_simple_hop <- function(.slide_comp, ..., .before_n_steps, .after_n
104
104
# ' @keywords internal
105
105
upstream_slide_to_simple_hop <- function (.f , ... , .in_colnames , .out_colnames , .before_n_steps , .after_n_steps ) {
106
106
f_info <- upstream_slide_f_info(.f , ... )
107
- in_colnames <- .in_colnames
107
+ in_colnames <- .in_colnames # TODO refactor away
108
108
out_colnames <- .out_colnames
109
109
f_from_package <- f_info $ from_package
110
110
switch (f_from_package ,
@@ -113,7 +113,9 @@ upstream_slide_to_simple_hop <- function(.f, ..., .in_colnames, .out_colnames, .
113
113
stop(" .before_n_steps only supported with .after_n_steps = 0" )
114
114
}
115
115
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 )
117
119
}
118
120
} else {
119
121
function (grp_data , grp_key , ref_inds ) {
@@ -126,16 +128,18 @@ upstream_slide_to_simple_hop <- function(.f, ..., .in_colnames, .out_colnames, .
126
128
c(out_col [(.after_n_steps + 1L ): length(out_col )], rep(NA , .after_n_steps ))
127
129
})
128
130
}
129
- out_cols
131
+ names(out_cols ) <- out_colnames
132
+ vec_slice(new_tibble(out_cols , nrow = nrow(grp_data )), ref_inds )
130
133
}
131
134
},
132
135
slider =
133
136
# TODO Inf checks?
134
137
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 ) {
137
139
.f(x = grp_data [[in_colname ]], before = .before_n_steps , after = .after_n_steps , ... )
138
140
})
141
+ names(out_cols ) <- out_colnames
142
+ vec_slice(new_tibble(out_cols , nrow = nrow(grp_data )), ref_inds )
139
143
},
140
144
# TODO improve message
141
145
stop(" unsupported package" )
0 commit comments