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
We can use
library(data.table) setDT(input)[,.(num=.N) , .(range=cut(value, breaks = c(0,20, 30, Inf), labels = c("0-20", "21-30", "30-")))]