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

set_table_properties

Global table properties


Description

Set table layout and table width. Default to fixed algorithm.

If layout is fixed, column widths will be used to display the table; width is ignored.

If layout is autofit, column widths will not be used; table width is used (as a percentage).

Usage

set_table_properties(x, layout = "fixed", width = 0)

Arguments

x

flextable object

layout

'autofit' or 'fixed' algorithm. Default to 'autofit'.

width

The parameter has a different effect depending on the output format. Users should consider it as a minimum width. In HTML, it is the minimum width of the space that the table should occupy. In Word, it is a preferred size and Word may decide not to strictly stick to it. It has no effect on PowerPoint and PDF output. Its default value is 0, as an effect, it only use necessary width to display all content. It is not used by the PDF output.

Illustrations

Note

PowerPoint output ignore autofit layout.

See Also

Other flextable dimensions: autofit(), dim.flextable(), dim_pretty(), fit_to_width(), flextable_dim(), height(), hrule(), ncol_keys(), nrow_part(), width()

Examples

library(flextable)
ft_1 <- qflextable(head(cars))
ft_2 <- set_table_properties(ft_1, width = .5, layout = "autofit")
ft_2

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.