I have the following panel dataset in R which contains an ID variable and shows the last login details for that ID.
id name address last_log_june1 last_log_june2 last_log_june3 last_log_june4 last_log_june"n"
1 A 2020-06-01 2020-06-01 2020-06-03
2 B 2020-06-01 2020-06-01 2020-06-01
3 C 2020-06-01 2020-06-02 2020-06-03
In the above dataset, I want to calculate the unique number of times A, B, and C have logged in. How do I do that in R such that I only select the "last_log_date" variables and make R count the unique dates within them? I also want to add this count column to the dataset.
Looking forward to solving this!
Thanks, Rachita