Skip to contents

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()

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

avg

3.0 (1.0)

6.0 (2.0)

9.0 (3.0)