fmt_avg_dev {flextable}R Documentation

Format content for mean and sd

Description

The function formats means and standard deviations as mean (sd).

Usage

fmt_avg_dev(avg, dev, digit1 = 1, digit2 = 1)

Arguments

avg, dev

mean and sd values

digit1, digit2

number of digits to show when printing 'mean' and 'sd'.

See Also

tabulator(), mk_par()

Other text formatter functions: fmt_2stats(), fmt_dbl(), fmt_header_n(), fmt_int(), fmt_n_percent(), fmt_pct(), fmt_signif_after_zeros()

Examples

library(flextable)

df <- data.frame(avg = 1:3 * 3, sd = 1:3)

ft_1 <- flextable(df, col_keys = "avg")
ft_1 <- mk_par(
  x = ft_1, j = 1, part = "body",
  value = as_paragraph(fmt_avg_dev(avg = avg, dev = sd))
)
ft_1 <- autofit(ft_1)
ft_1

[Package flextable version 0.9.6 Index]