I need to calculate the frequency of individuals by age and marital status so normally I'd use:
table(age, marital_status)
However each individual has a different weight after the sampling of the data. How do I incorporate this into my frequency table?
You can also use tablefreq from package freqweights:
You can use function
svytable
from packagesurvey
, orwtd.table
fromrgrs
.EDIT :
rgrs
is now calledquestionr
:That's also possible with
dplyr
:Using
data.table
you could do: