View source: R/flextable_sizes.R
| fit_columns | R Documentation |
Shrink column widths so that the total table width
does not exceed max_width. Font sizes are unchanged; text wraps
inside the narrower cells.
Columns that cannot shrink below their longest word (plus padding) are clamped at that floor; remaining space is iteratively redistributed among unclamped columns.
Columns listed in no_wrap keep their optimal width (as computed
by dim_pretty()) and are not compressed.
To constrain width by reducing font size instead, see
fit_to_width(). To size columns to their content without a
width constraint, see autofit().
fit_columns(x, max_width, no_wrap = NULL, unit = "in")
x |
a 'flextable' object, see flextable-package to learn how to create 'flextable' object. |
max_width |
maximum total table width (in inches by default) |
no_wrap |
column names or indices that must keep their optimal width (no compression, no text wrapping). |
unit |
unit for |
Other functions for flextable size management:
autofit(),
dim.flextable(),
dim_pretty(),
fit_to_width(),
flextable_dim(),
height(),
hrule(),
ncol_keys(),
nrow_part(),
set_table_properties(),
width()
ft <- qflextable(head(mtcars))
ft <- fit_columns(ft, max_width = 5)
flextable_dim(ft)$widths
ft
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.