Skip to content

Commit 5ba2df9

Browse files
committed
reference group, ref time by changing quo env
1 parent d5f35fb commit 5ba2df9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

NAMESPACE

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ importFrom(rlang,pairlist2)
110110
importFrom(rlang,quo_get_env)
111111
importFrom(rlang,quo_get_expr)
112112
importFrom(rlang,quo_is_missing)
113+
importFrom(rlang,quo_set_env)
113114
importFrom(rlang,sym)
114115
importFrom(rlang,syms)
115116
importFrom(stats,cor)

R/grouped_epi_archive.R

+5-2
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ grouped_epi_archive =
186186
#' object. See the documentation for the wrapper function [`epix_slide()`] for
187187
#' details.
188188
#' @importFrom data.table key address
189-
#' @importFrom rlang !! !!! enquo quo_is_missing enquos is_quosure sym syms
189+
#' @importFrom rlang !! !!! enquo quo_is_missing enquos is_quosure sym syms quo_set_env
190190
slide = function(f, ..., before, ref_time_values,
191191
time_step, new_col_name = "slide_value",
192192
as_list_col = FALSE, names_sep = "_",
@@ -437,7 +437,10 @@ grouped_epi_archive =
437437
}
438438

439439
quo = quos[[1]]
440-
f = function(x, quo, ...) rlang::eval_tidy(quo, x)
440+
f = function(x, group_key, ref_time_value, quo, ...) {
441+
quo = quo_set_env(quo, env(group_key = group_key, ref_time_value = ref_time_value))
442+
rlang::eval_tidy(quo, x)
443+
}
441444
new_col = sym(names(rlang::quos_auto_name(quos)))
442445

443446
x = purrr::map_dfr(ref_time_values, function(ref_time_value) {

0 commit comments

Comments
 (0)