as_survey_design --> gt --> printing in a Word knit

Hi - I've structured a survey proportion with CI's as follows; I would like to knit to a Word document, but gt is not compatible - can I save this as as_flex_table or as_hux_table instead?

baro_weightedpointprevalence_srvyr <- table3_baro %>%
as_survey_design(ids=grappe_no,fpc=fpc, weights=HH_weight_normalized)

  table <- baro_weightedpointprevalence_srvyr  %>%
  group_by(GAM_any) %>%
  summarize(proportion=survey_prop(vartype="ci", level=.95),
            total=survey_total(na.rm=TRUE))             
  
  table3_baro_gt <- table %>% select(-starts_with("total_"))
gt(table3_baro_gt)  |>
 gt::cols_label(GAM_any = "GAM- any",
  proportion = "Prevalence",
  proportion_low = "Lower Bound- 95% CI",
  proportion_upp="Upper Bound- 95% CI",
  total = "Count") |> 
  tab_spanner("Proportion", contains("prop")) |> 
  tab_spanner("Total", contains("total")) |> 
  tab_header(title=md("**Baro- GAM**")) |>
  fmt_percent(contains("prop"), drop_trailing_zeros = T, decimals=1) |> 
  cols_width(proportion:total ~ px(75))

When I do this:

  as_hux_table(
  table3_baro_gt,
  include = everything(),
  return_calls = FALSE,
  strip_md_bold = FALSE
)

I get this error message:


 i Updating gtsummary object from `x$table_header` to `x$table_styling` introduced in "v1.4.0".
Error in UseMethod("mutate") : 
  no applicable method for 'mutate' applied to an object of class "NULL"

Hello!

Reading your post, it seems to be a mix of {gt} and {gtsummary} code (different packages).
Can you provide a reproducible example (something we can run on our machines), and we can try to troubleshoot with you.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.