collapse_counts | R Documentation |
#' When a grouping variable count_by has more than two levels, this utility collapses all of the level-specific columns
collapse_counts(df, count_by)
df |
A data.frame produced by one of the TableSubgroup functions |
count_by |
A string giving the name of the variable whose per-level count columns should be collapsed. If NULL, df is returned unmodified. |
This helper is intended for internal use by TableSubgroupCox(), TableSubgroupMultiCox(), and their GLM equivalents. It simplifies reporting when you request counts stratified by a factor with more than two levels.
A data.frame identical to 'f except that: All Count(count_by=…) columns are removed. A single column Count(by count_by) remains, containing the first non-missing, non-empty value from the original per-level columns.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.