flextable (version 0.5.1)

colformat_num: format numeric columns

Description

Format numeric columns in a flextable.

Usage

colformat_num(x, ...)

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

Arguments

x

a flextable object

...

additional arguments, unused

col_keys

names of the colkeys

big.mark, digits
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

See Also

Other columns formatters: colformat_char, colformat_int, colformat_lgl

Examples

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

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

Run the code above in your browser using DataCamp Workspace