The function creates the labels for each column using the total function so the columns are now NAME N= X

col_for_list_expr(col_names, col_total)

Arguments

col_names

A vector of column names

col_total

A vector of column totals

Value

A character object of class from_markdown.

Examples

data(example_dat2, package = "tidyCDISC")

labels <- col_for_list_expr(example_dat2$col_names, example_dat2$col_totals)
labels
#> $Placebo
#> [1] "**Placebo** <br> N=8"
#> attr(,"class")
#> [1] "from_markdown"
#> 
#> $`Xanomeline Low Dose`
#> [1] "**Xanomeline Low Dose** <br> N=7"
#> attr(,"class")
#> [1] "from_markdown"
#> 
#> $`Xanomeline High Dose`
#> [1] "**Xanomeline High Dose** <br> N=10"
#> attr(,"class")
#> [1] "from_markdown"
#> 
#> $Total
#> [1] "**Total** <br> N=25"
#> attr(,"class")
#> [1] "from_markdown"
#> 

if (interactive()) {
# TG table without nice column labels or totals
example_dat2$TG_table

# TG table with nice column labels and totals
gt::cols_label(example_dat2$TG_table, .list = labels)
}