I\'ve started with R and I\'m still finding my way with syntax. I\'m looking to get the frequencies for a scaled variable which has values of 0 through 10 and NA.
This kind of tasks is easily done with package dplyr. For keeping the non-used values of R, you have to define R as factor and use tidyr's complete-function
library(dplyr)
library(tidyr)
df %>%
mutate(R = factor(R, levels=1:10)) %>%
group_by(R) %>%
summarise(freq=n()) %>%
complete(R, fill=list(freq=0))