This blog post is just a note that when you try to do a grouped summary of a date variable but some groups haveallmissing values, it will returnInf. This means that the summary will not show up as anNAand this can cause issues in analysis if you are not careful.library(tidyverse)
df <- tibble::tribble(
~id, ~dt,
1L, "01/01/2001",
1L, NA,
2L, NA,
2L, NA
) %>%
mutate(dt = dmy(dt))
z1 <- df %>%
group_by(id) %>%
summarise(dt_min = min(dt, na.rm = TRUE),
.groups = "drop")
z1
# A tibble: 2 × 2
# id dt_min
...
继续阅读
(67)