I have a data frame as given.
The image contains two columns NAME and RANGE. range have values starting from 50000 to 70000 I want to dived Range in the group of 2000 like from 5000 to 52000 whichever ever value comes that should fall in that group and then I want to find the standard deviation of that group.
I was using the following code
tally(group_by(df,RANGE=cut(RANGE,breaks = seq(50000,70000,by=2000,))) %>%
ungroup() %>%
spread(RANGE,n,fill = 0)
but I am not able to calculate S.d from this
I want my output as follow
RANGE FREQ S.D
50K-52K 10 1.2
52K-54K 5 0.8
....
...
68K-70K 4 2