diff --git a/R/slide.R b/R/slide.R index 4b3f73c49..fafa264c6 100644 --- a/R/slide.R +++ b/R/slide.R @@ -627,7 +627,7 @@ epi_slide_mean <- function(x, col_names, ..., before, after, ref_time_values, .data_group, tibble(time_value = c(missing_times, pad_early_dates, pad_late_dates), .real = FALSE) ) %>% - arrange(time_value) + arrange(.data$time_value) # If a group contains duplicate time values, `frollmean` will still only # use the last `k` obs. It isn't looking at dates, it just goes in row @@ -721,7 +721,7 @@ full_date_seq <- function(x, before, after, time_step) { # `tsibble` classes apparently can't be added to in different units, so even # if `time_step` is provided by the user, use a unit step. if (inherits(x$time_value, c("yearquarter", "yearweek", "yearmonth")) || - is.numeric(x$time_value)) { + is.numeric(x$time_value)) { all_dates <- seq(min(x$time_value), max(x$time_value), by = 1L) if (before != 0) { diff --git a/tests/testthat/test-epi_slide.R b/tests/testthat/test-epi_slide.R index 0833b71c3..8b5094522 100644 --- a/tests/testthat/test-epi_slide.R +++ b/tests/testthat/test-epi_slide.R @@ -1037,17 +1037,17 @@ test_that("results for different time_types match between epi_slide and epi_slid epiprocess::as_epi_df(rbind(tibble( geo_value = "al", time_value = date_seq, - a = 1:length(date_seq), + a = seq_along(date_seq), b = rand_vals ), tibble( geo_value = "ca", time_value = date_seq, - a = length(date_seq):1, + a = rev(seq_along(date_seq)), b = rand_vals + 10 ), tibble( geo_value = "fl", time_value = date_seq, - a = length(date_seq):1, + a = rev(seq_along(date_seq)), b = rand_vals * 2 )), ...) } @@ -1175,17 +1175,17 @@ test_that("helper `full_date_seq` returns expected date values", { epiprocess::as_epi_df(rbind(tibble( geo_value = "al", time_value = date_seq, - a = 1:length(date_seq), + a = seq_along(date_seq), b = rand_vals ), tibble( geo_value = "ca", time_value = date_seq, - a = length(date_seq):1, + a = rev(seq_along(date_seq)), b = rand_vals + 10 ), tibble( geo_value = "fl", time_value = date_seq, - a = length(date_seq):1, + a = rev(seq_along(date_seq)), b = rand_vals * 2 )), ...) }