I am new to programming and currently using R.
I am trying to create a survey table that takes into consideration the survey design.
I created my svydesign
variable, which works, but I am now struggling with the svytable
function. Please see below my code:
svytable(
~ C_HAZ_GR + C_SEX2,
design = DHS_2015_ZBW,
data = fin_df,
na.action = na.exclude
)
And I get the following error:
no applicable method for 'svytable' applied to an object of class "c('spec_tbl_df', 'tbl_df', 'tbl', 'data.frame')"
I get the same error if I try to use a very simple table, such as:
svytable(~C_HAZ_GR, design = DHS_2015_ZBW)
Could anyone help me?