I have a huge survey csv file, which I imported in Rstudio. Here is a sample data
User 1 User 2 Duration
5 2 7-11 months
5 5 Less than 1 month
5 5 4-6 months
5 5 4-6 months
5 4 4-6 months
5 5 2 years
4 6 1 year
4 4 4-6 months
4 8 7-11 months
4 4 2 years
3 3 Less than 1 month
3 3 7-11 months
3 3 1-3 months
I want to calculate sum of user1
, filtering with duration, say 4-6 months
.
Till now I have used :
df %>% group_by(Duration) %>% summarise(count=n_distinct(User1)) %>%
+ filter(Duration=="4-6 months")
But its not returning proper values. Please suggest me the solution.