From 2768552c4f299633c1c9633ab65d067e3003cbb4 Mon Sep 17 00:00:00 2001 From: Nat DeFries <42820733+nmdefries@users.noreply.github.com> Date: Tue, 15 Oct 2024 15:42:22 -0400 Subject: [PATCH] use case_when to avoid converting numeric -> Date --- tests/testthat/test-utils_latency.R | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/testthat/test-utils_latency.R b/tests/testthat/test-utils_latency.R index 3ba6453a0..d0fd429a9 100644 --- a/tests/testthat/test-utils_latency.R +++ b/tests/testthat/test-utils_latency.R @@ -8,7 +8,10 @@ old_data <- tibble( tmp_death_rate = atan(0.1 * 1:200) + cos(5 * 1:200) + 1 ) %>% # place2 is slightly more recent than place1 - mutate(time_value = as.Date(ifelse(geo_value == "place2", time_value + 1, time_value))) %>% + mutate(time_value = case_when( + geo_value == "place2" ~ time_value + 1, + TRUE ~ time_value + )) %>% as_epi_df(as_of = as_of) old_data keys <- c("time_value", "geo_value")