Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

compose

Define flextable displayed values


Description

Modify flextable displayed values. Function is handling complex formatting as well as image insertion.

Function mk_par is another name for compose as there is an unwanted conflict with package purrr.

Usage

compose(x, i = NULL, j = NULL, value, part = "body", use_dot = FALSE)

mk_par(x, i = NULL, j = NULL, value, part = "body", use_dot = FALSE)

Arguments

x

a flextable object

i

rows selection

j

column selection

value

a call to function as_paragraph().

part

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

use_dot

by default use_dot=FALSE; if use_dot=TRUE, value is evaluated within a data.frame augmented of a column named . containing the jth column.

Illustrations

See Also

Examples

library(officer)
ft <- flextable(head( mtcars, n = 10))
ft <- compose(ft, j = "carb", i = ~ drat > 3.5,
  value = as_paragraph("carb is ", as_chunk( sprintf("%.1f", carb)) )
  )
ft <- autofit(ft)

flextable

Functions for Tabular Reporting

v0.6.10
GPL-3
Authors
David Gohel [aut, cre], Clementine Jager [ctb], Quentin Fazilleau [ctb], Maxim Nazarov [ctb] (rmarkdown for docx output), Titouan Robert [ctb], Michael Barrowman [ctb] (inline footnotes), Atsushi Yasumoto [ctb] (support for bookdown cross reference), Paul Julian [ctb] (support for gam objects)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.