Skip to contents

A percentage value acts as a length value that is relative to an initial state. For instance an 80 percent value for something will size the target to 80 percent the size of its 'previous' value. This type of sizing is useful for sizing up or down a length value with an intuitive measure. This helper function can be used for the setting of font sizes (e.g., in cell_text()) and altering the thicknesses of lines (e.g., in cell_borders()). Should a more exact definition of size be required, the analogous helper function pct() will be more useful.





the numeric value to format as a string percentage for some tab_options() arguments that can take percentage values (e.g., table.width).


A character vector with a single value in percentage units.


Use exibble to create a gt table. Use the pct() helper to define the font size for the column labels.

exibble %>%
  gt() %>%
    style = cell_text(size = pct(75)),
    locations = cells_column_labels()

This image of a table was generated from the first code example in the `pct()` help file.

Function ID