compose() and mk_par() are identical functions that set the displayed content of selected cells using paragraph chunks. They handle complex formatting such as inline images, superscripts, formatted text, and hyperlinks.
mk_par() is an alias for compose() introduced to avoid a naming conflict with purrr::compose(). Prefer mk_par() in projects that use purrr.Function signature
Parameters
A
flextable object.Row selector. Accepts integer indices, a one-sided formula (e.g.,
~ dist > 9), or a logical vector. NULL selects all rows.Column selector. Accepts integer indices, column names, a formula, or a logical vector.
A call to
as_paragraph() defining the new cell content.Which part of the table to target:
"body", "header", "footer", or "all".If
TRUE, the value expression is evaluated in a data frame augmented with a column named . containing the values of the jth column. This enables column-referencing syntax like minibar(., ...) or as_chunk(.) inside as_paragraph().Return value
The modifiedflextable object.
Examples
Add formatted text with a superscript to a specific column, targeting rows conditionally:use_dot = TRUE to reference the column’s own values inside as_paragraph():
See also
as_paragraph()— build paragraph content from chunksas_chunk()— formatted text chunkappend_chunks()— append chunks to existing cell contentfootnote()— add footnote references and notes