c_label_n: Content row function to add row total to labels

View source: R/utils_rtables.R

c_label_nR Documentation

Content row function to add row total to labels

Description

This takes the label of the latest row split level and adds the row total from df in parentheses. This function differs from c_label_n_alt() by taking row counts from df rather than alt_counts_df, and is used by add_rowcounts() when alt_counts is set to FALSE.

Usage

c_label_n(df, labelstr, .N_row)

Arguments

df

(data.frame)
data set containing all analysis variables.

labelstr

(string)
label of the level of the parent split currently being summarized (must be present as second argument in Content Row Functions). See rtables::summarize_row_groups() for more information.

.N_row

(integer(1))
row-wise N (row group count) for the group of observations being analyzed (i.e. with no column-based subsetting) that is typically passed by rtables.

Value

A list with formatted rtables::CellValue() with the row count value and the correct label.

Note

It is important here to not use df but rather .N_row in the implementation, because the former is already split by columns and will refer to the first column of the data only.

See Also

c_label_n_alt() which performs the same function but retrieves row counts from alt_counts_df instead of df.


tern documentation built on June 22, 2024, 10:25 a.m.