Learn R Programming

flextable (version 0.3.0)

display: Define flextable displayed values

Description

Modify flextable displayed values by specifying a string expression. Function is handling complex formatting as well as image insertion.

Usage

display(x, i = NULL, col_key, pattern, formatters = list(),
  fprops = list(), part = "body")

Arguments

x

a flextable object

i

rows selection

col_key

column to modify, a single character

pattern

string to format

formatters

a list of formula, left side for the name, right side for the content.

fprops

a named list of fp_text

part

partname of the table (one of 'all', 'body', 'header')

Examples

Run this code
# NOT RUN {
# Formatting data values example ------
library(magrittr)
ft <- flextable(head( mtcars, n = 10))
ft <- display(ft, col_key = "carb",
  i = ~ drat > 3.5, pattern = "# {{carb}}",
  formatters = list(carb ~ sprintf("%.1f", carb)),
  fprops = list(carb = fp_text(color="orange") ) )
# }
# NOT RUN {
ft <- autofit(ft)
# }

Run the code above in your browser using DataLab