flextable (version 0.5.11)

colformat_num: format numeric cells

Description

Format numeric cells in a flextable.

Usage

colformat_num(x, ...)

# S3 method for flextable colformat_num( x, j = NULL, col_keys = NULL, big.mark = ",", decimal.mark = getOption("OutDec"), digits = 2, na_str = "", prefix = "", suffix = "", ... )

Arguments

x

a flextable object

...

additional arguments, i can be used to specify a row selector.

j

columns selection.

col_keys

names of the colkeys. Will be deprectated in favor of j in the next version.

big.mark, digits, decimal.mark
na_str

string to be used for NA values

prefix

string to be used as prefix or suffix

suffix

string to be used as prefix or suffix

Illustrations

See Also

Other cells formatters: colformat_char(), colformat_int(), colformat_lgl(), compose(), set_formatter()

Examples

Run this code
# NOT RUN {
dat <- iris
dat[1:4, 1] <- NA
dat[, 2] <- dat[, 2] * 1000000

ft <- flextable(head(dat))
j = c("Sepal.Length", "Sepal.Width",
   "Petal.Length", "Petal.Width")
ft <- colformat_num(
  x = ft, j = j,
  big.mark=",", digits = 2, na_str = "N/A")
autofit(ft)
# }

Run the code above in your browser using DataLab