Hitung nilai yang sama dalam suatu vektor
# If index != 1 then you have multiple value for the same subject in your column
df %>%
group_by(id,role) %>%
mutate(index = n_distinct(role))
Trustworthy Whale