Errors when creating the descriptive statistics with the survey weights in R

Hello,

I am using the survey weights as suggested here forum discussion. However, I can not use this survey design to create the descriptive statistics table use tbl_svysummary function in the gtsummary package. It keeps giving me this warning:

And my tbl_svysummary codes are like this:

    df_descriptive <- df %>% 
      tbl_svysummary(
              by = group,
              missing = "ifany",
              include = c(age, sex, race, marital,
                          hispanic, citizen, education,
                          region, rurality, poverty),
              type = all_dichotomous() ~ "categorical",
              statistic = list(all_continuous() ~ "{median} ({p25}, {p75})", 
                               all_categorical() ~ "{n} ({p}%)"),
              digits = list(all_categorical() ~ c(0, 2))) %>%
      add_overall()

Does anyone know what is wrong here? Or, Is there any other way to create the descriptive table efficiently?

Thanks so much!!

The post that you link to describes how to run an analysis in R using replicate weights. However, it does not appear that the tbl_svysummary function or the gtsummary package allow for replicate weights. I was able to find this StackOverflow post that specifically mentions the error message that you are seeing. The package author replies stating that “replicate weights are not currently supported.”

Therefore, you will need to run your analysis without replicate weights, or use a different package (such as srvyr as described in this user guide) that does accept replicate weights. Please note that replicate weights (i.e. REPWT, REPWTP) are different from survey weights (e.g. WTFINL, HWTFINL).