【问题标题】:How do you add the number of observations for each category when summarising using gtsummary for a continuous variable over two categorical variables?在使用 gtsummary 对两个分类变量上的连续变量进行汇总时,如何添加每个类别的观察数?
【发布时间】:2021-03-03 20:36:01
【问题描述】:

在下面的例子中,

  # keep the continuous var and the two categorical variables
  select(trt, age, grade) %>%
  group_nest(grade) %>%
  mutate(
    tbl = map2(
      grade, data, 
      ~tbl_summary(.y, by = trt, 
                   label = list(age = paste("Age: Grade", .x)), missing = "no")
    )
  ) %>% 
  pull(tbl) %>% 
  tbl_stack() %>%
  as_tibble()

每个年龄的观察次数:年级应该加在哪里?

【问题讨论】:

    标签: nested categories summarize continuous gtsummary


    【解决方案1】:

    添加选项

    statistic = all_continuous() ~ c("{N_nonmiss}")

    解决了我的问题。谢谢

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-03
      • 1970-01-01
      • 2021-11-03
      • 2019-05-01
      • 1970-01-01
      • 2023-02-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多