I have my table(input)
name value
Rob 35
Helen 20
Sergey 16
Linn 40
Elena 23
Mary 40
And I want to count how many of my users is
Using dplyr, you can create (mutate) a new column indicating in which interval the value belongs (using cut) and then use this column to group your values and count (n()) how many of them you have:
library(dplyr)
df %>% mutate(cuts = cut(value, c(0, 20, 30, Inf))) %>%
group_by(cuts) %>%
summarize(n=n())
# cuts n
# (fctr) (int)
# 1 (0,20] 2
# 2 (20,30] 1
# 3 (30,Inf] 3