0

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?

AndrewGB
  • 12,571
  • 4
  • 13
  • 38
Patrizia
  • 1
  • 2
  • 2
    It's really hard to do more than guess without a [reproducible example](https://stackoverflow.com/q/5963269/5325862)—we don't have your data or your survey design. Do you have any errors when you run the package examples? – camille Dec 29 '21 at 17:45
  • Hello, this is my survey design: DHSdesign – Patrizia Dec 29 '21 at 18:26
  • Read the link in my comment, which gives examples of ways to make a question reproducible, and [edit] the question to include that additional code – camille Dec 29 '21 at 18:30

0 Answers0