You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Abort("The starting and/or stopping times for sliding are out of bounds with respect to the range of times in your data. Check your settings for ref_time_values and align (and before, if specified).")
269
-
}
237
+
starts<-ref_time_values-before
238
+
stops<-ref_time_values+after
270
239
271
240
# Symbolize new column name
272
241
new_col<- sym(new_col_name)
273
242
274
243
# Computation for one group, all time values
275
244
slide_one_grp<-function(.data_group,
276
-
f, ...,
245
+
.group_key, # see `?group_modify`
246
+
..., # `...` to `epi_slide` forwarded here
247
+
f_factory,
277
248
starts,
278
249
stops,
279
-
time_values,
250
+
ref_time_values,
280
251
all_rows,
281
252
new_col) {
282
253
# Figure out which reference time values appear in the data group in the
283
254
# first place (we need to do this because it could differ based on the
284
255
# group, hence the setup/checks for the reference time values based on all
285
-
# the data could still be off)
286
-
o<-time_values%in%.data_group$time_value
256
+
# the data could still be off):
257
+
o<-ref_time_values%in%.data_group$time_value
287
258
starts<-starts[o]
288
259
stops<-stops[o]
289
-
time_values<-time_values[o]
260
+
kept_ref_time_values<-ref_time_values[o]
261
+
262
+
f<- f_factory(kept_ref_time_values)
290
263
291
264
# Compute the slide values
292
265
slide_values_list<-slider::hop_index(
293
266
.x=.data_group,
294
267
.i=.data_group$time_value,
295
-
.f=f, ...,
296
268
.starts=starts,
297
-
.stops=stops
269
+
.stops=stops,
270
+
.f=f,
271
+
.group_key, ...
298
272
)
299
273
300
274
# Now figure out which rows in the data group are in the reference time
301
275
# values; this will be useful for all sorts of checks that follow
302
-
o<-.data_group$time_value%in%time_values
276
+
o<-.data_group$time_value%in%kept_ref_time_values
303
277
num_ref_rows<- sum(o)
304
278
305
-
# Count the number of appearances of each reference time value (these
306
-
# appearances should all be real for now, but if we allow ref time values
0 commit comments