I'm trying to create a tbl_summary that has a strata category, and within each strata category, two seperate categorical (likely binary) variables. Here's an example of how I want the table to be laid out, however, the n/% for d are placeholders and not true to my example...
Summary typeThere are two primary ways to select variables by their summary type. This is useful, for example, when you wish to report the mean and standard deviation for all continuous variables:statistic = all_continuous() ~ "{mean} ({sd})". all_continuous()all_categorical() Dichotomous ...
base包中的sweep函数是处理统计量的工具,一般可以结合apply()函数来使用。当我们我们需要将apply()统计...
() # Example 2 --- add_p_ex2 <- trial %>% select(trt, age, marker) %>% tbl_summary(by = trt, missing = "no") %>% add_p( # perform t-test for all variables test = everything() ~ "t.test", # assume equal variance in the t-test test.args = all_tests("t.test") ...