Relative Content

Tag Archive for rgtsummary

gtsummary with multi-categorical variable

I would like to summarize a table with a categorical variable, that can more than one category for any given id (i.e., in my example below, a semicolon-separated list within a cell). The denominator should be the number of unique ids (i.e., in my example below, n_ids = 5), and percentages should therefore add to greater than 100%. I’m not sure how to get gtsummary to use my desired denominator. See the reprex and my desired output below. Thank you for your help.

gtsummary inline_text(), use of column by name

I am creating an table by tbl_summary and use inline_text(), to use the results.
Since an update using the colnames doesn’t work, I am required to use “stat_1” instead.
However, when I print the whole table, it shows the labels correctly.

Group variables into toplevel variables within tbl_summary()

I would like to manually set groups for variables inside the call to tbl_summary. A group of variables should be reported both individually and as a group.
If i had a logical variable apple and a logical variable banana, i would like to report the frequencies of apple and banana, but also for fruits.