From a data frame like this
data.frame(id= c(1,1,2,3,3), visits = c(32,30,1,2,4))
How is it possible to produce a average number column of visits per numi but also add a new column which will have the number/frequency of numbers exist in numi column Expected output:
data.frame(id= c(1,2,3), numi_frq = c(2,1,2), average = c(31,1,3))