Skip to content

Commit 7e1eeae

Browse files
committed
perf(slide.R): remove some data-masking, tidyeval
1 parent 3f10e93 commit 7e1eeae

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

R/slide.R

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,14 +310,13 @@ epi_slide <- function(
310310
.keep = TRUE
311311
) %>%
312312
bind_rows() %>%
313-
filter(.real) %>%
314-
select(-.real) %>%
313+
`[`(.$.real, names(.) != ".real") %>%
315314
arrange_col_canonical() %>%
316315
group_by(!!!.x_orig_groups)
317316

318317
# If every group in epi_slide_one_group takes the
319318
# length(available_ref_time_values) == 0 branch then we end up here.
320-
if (ncol(result) == ncol(.x %>% select(-.real))) {
319+
if (ncol(result) == ncol(.x[names(.x) != ".real"])) {
321320
cli_abort(
322321
"epi_slide: no new columns were created. This can happen if every group has no available ref_time_values.
323322
This is likely a mistake in your data, in the slide computation, or in the ref_time_values argument.",
@@ -957,8 +956,7 @@ epi_slide_opt <- function(
957956

958957
result <- mutate(.x, .real = TRUE) %>%
959958
group_modify(slide_one_grp, ..., .keep = FALSE) %>%
960-
filter(.data$.real) %>%
961-
select(-.real) %>%
959+
`[`(.$.real, names(.) != ".real") %>%
962960
arrange_col_canonical() %>%
963961
group_by(!!!.x_orig_groups)
964962

0 commit comments

Comments
 (0)