I have a dataframe:
ID Date col1 col2
1 1606807860 LOY A
2 1606807860 LOY B
2 1606807860 LOY B
3 1606807860 LOY B
1 1606807860 LOY A
I want to count number of occurrences of unique values according to ID, Date, col1 and col2. So, desired result is:
ID Date event count
1 1606807860 loy-a 2
2 1606807860 loy-b 2
3 1606807860 loy-b 1
How could I do that? Also how to transform timestamp format into normal form, not 1606807860? how to change date type? make it like year-month-day?
This works for counting in case of only col1 and col2:
%>%
mutate(across(c(col1, col2), tolower)) %>%
count(col1, col2) %>%
unite(event, col1, col2, sep='-')