R:在gtsummary包中使用选择助手功能时出现问题

时间:2020-04-12 15:08:24

标签: r gtsummary

我正在使用gtsummary软件包来构建患者特征表。使用选择功能all_dichotomous时出现问题。有些变量默认显示为一行,但我希望它们全部显示为多行。

这是我正在使用的代码,但出现错误。有什么建议?谢谢!该数据集在包装中。

library(gtsummary)
trial %>%
  tbl_summary(type = list(all_dichotomous = "categorical"))

1 个答案:

答案 0 :(得分:0)

您差不多了!您将要在列表中使用公式符号,而不是命名列表。像这样:

library(gtsummary)
trial %>%
  dplyr::select(response, age) %>%
  tbl_summary(type = list(all_dichotomous() ~ "categorical"))

enter image description here

这里有一些示例:http://www.danieldsjoberg.com/gtsummary/articles/tbl_summary.html#select_helpers