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

col_width

Set the width of table columns


Description

Numeric column widths are treated as proportions of the table width. Character widths must be valid CSS or LaTeX dimensions.

Usage

col_width(ht)
col_width(ht) <- value
set_col_width(ht, col, value)

Arguments

ht

A huxtable.

col

A col specifier. See rowspecs for details.

value

Numeric or character vector.. Set to NA to reset to the default, which is NA.

Details

In LaTeX, if you specify a column width, but set wrap to FALSE and have cells which overrun, then you may have problems with table position and with background colours in other cells. The workaround is to adjust the width, so that your cells no longer overrun.

Value

col_width() returns the col_width property. set_col_width() returns the modified huxtable.

See Also

Other table measurements: height(), row_height(), width()

Examples

col_width(jams) <-  c(.2, .8)
col_width(jams)
jams$Notes <- c("Notes",
      "This year's finest", "", "")
jams
set_col_width(jams, c(.4, .5, .1))

huxtable

Easily Create and Style Tables for LaTeX, HTML and Other Formats

v5.3.0
MIT + file LICENSE
Authors
David Hugh-Jones [aut, cre]
Initial release

We don't support your browser anymore

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