h_fmt_count_perc {mcradds}R Documentation

Format count and percent

Description

[Experimental]

Help function to format the count and percent into one string.

Usage

h_fmt_count_perc(cnt, perc = NULL, format, ...)

Arguments

cnt

(numeric)
numeric vector for count.

perc

(numeric)
numeric vector for percent, if Null only format count.

format

(string)
formatting string from formatters::list_valid_format_labels() for formatters::format_value() function.

...

other arguments to be passed to formatters::format_value.

Value

A character vector of formatted counts and percents.

Examples

h_fmt_count_perc(cnt = c(5, 9, 12, 110, 0), format = "xx")
h_fmt_count_perc(
  cnt = c(5, 9, 12, 110, 0),
  perc = c(0.0368, 0.0662, 0.0882, 0.8088, 0),
  format = "xx (xx.x%)"
)

[Package mcradds version 1.1.0 Index]