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
Here is a full solution, including your sample data:
df <- data.frame(name=c("r", "h", "s", "l", "e", "m"), value=c(35,20,16,40,23,40))
# get categories
df$groups <- cut(df$value, breaks=c(0,21,30,Inf))
# calculate group counts:
table(cut(df$value, breaks=c(0,21,30,Inf)))
If Inf is a little too extreme, you can use max(df$value) instead.