Попробуйте:
library(dplyr)
df %>%
group_by(id) %>%
mutate_at(-1, as.numeric) %>%
summarise_at(-1, ~ case_when(n_distinct(.) != 1 ~ 0, TRUE ~ first(.)))
Вывод:
# A tibble: 1 x 7
id t1 t2 t3 t4 t5 t6
<int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 12 0 0 12 12 12 17
Вы также можете заменить n_distinct(.) != 1
на !all(. == .[1])
, !any(duplicated(.))
или sd(.) != 0
, среди прочих.