A simple statistics function which prepares the numbers with percentages in the required format. The denominator here is from the alternative counts data set in the given row and column split.
If a total row is shown, then here just the total number is shown (without 100%).
s_proportion_factor(
x,
.alt_df,
use_alt_counts = TRUE,
show_total = c("none", "top", "bottom"),
total_label = "Total"
)The rtables::in_rows() result with the proportion statistics.
(factor)
categorical variable we want to analyze.
(data.frame)
alternative data frame used for denominator calculation.
(flag)
whether the .alt_df should be used for the total, i.e. the denominator.
If not, then the number of non-missing values in x is used.
(string)
show the total level optionally on the top or in the bottom
of the factor levels.
(string)
which label to use for the optional total level.
s_proportion_logical() for tabulating logical x.