天道酬勤,学无止境

tbl

带有分类变量总计的 R gsummary Row(R gtsummary Row with Categorical Variable Totals)

问题 我有大约 700,000 名患者的数据集,其中有医院站点 ID(因子变量)。 我想创建一行,其中医院的数量是可见的(这与患者的数量是分开的)。 除了整个列之外,我还有 3 个分类变量作为我的列。 目前,每个医院 id 都有一个单独的行,其中包含每个类别的每个站点的患者数量。 我的代码如下: t1 <- PIR %>% select(siteidn, countryname) %>% tbl_summary(by = countryname ,missing = "no", label = list( siteidn = "Number of ICUs"), statistic = list( all_continuous() ~ "{mean} ({sd})", all_categorical() ~ "{n} ({p}%)")) %>% bold_labels() %>% italicize_levels() %>% add_overall() t2 <- PIR %>% select(siteidn, hospt) %>% tbl_summary(by = hospt ,missing = "no", label = list( siteidn = "Number of ICUs"), statistic = list( all_continuous() ~ "{mean

2021-10-30 21:57:41    分类:技术分享    r   summary   gtsummary   tbl

R gtsummary Row with Categorical Variable Totals

I have a dataset of approximately 700,000 patients where I have hospital site IDs (factor variable). I would like to create a row where the number of hospitals is visible (this is separate to the number of patients). I have 3 categorical variables as my columns in addition to an overall column. At the moment, there is a separate row for each hospital id with the number of patients in each site for each category. My code is as follows: t1 <- PIR %>% select(siteidn, countryname) %>% tbl_summary(by = countryname ,missing = "no", label = list( siteidn = "Number of ICUs"), statistic = list( all

2021-09-24 02:59:32    分类:问答    r   summary   gtsummary   tbl