h_format_row: Helper function to format the optional 'g_lineplot' table

View source: R/g_lineplot.R

h_format_rowR Documentation

Helper function to format the optional g_lineplot table

Description

[Stable]

Usage

h_format_row(x, format, labels = NULL)

Arguments

x

(named list)
list of numerical values to be formatted and optionally labeled. Elements of x must be numeric vectors.

format

(named character or NULL)
format patterns for x. Names of the format must match the names of x. This parameter is passed directly to the rtables::format_rcell function through the format parameter.

labels

(named character or NULL)
optional labels for x. Names of the labels must match the names of x. When a label is not specified for an element of x, then this function tries to use label or names (in this order) attribute of that element (depending on which one exists and it is not NULL or NA or NaN). If none of these attributes are attached to a given element of x, then the label is automatically generated.

Value

A single row data.frame object.

Examples

mean_ci <- c(48, 51)
x <- list(mean = 50, mean_ci = mean_ci)
format <- c(mean = "xx.x", mean_ci = "(xx.xx, xx.xx)")
labels <- c(mean = "My Mean")
h_format_row(x, format, labels)

attr(mean_ci, "label") <- "Mean 95% CI"
x <- list(mean = 50, mean_ci = mean_ci)
h_format_row(x, format, labels)


tern documentation built on Sept. 24, 2024, 9:06 a.m.