propose_column_widths: Propose column widths based on the 'MatrixPrintForm' of an...

View source: R/tostring.R

propose_column_widthsR Documentation

Propose column widths based on the MatrixPrintForm of an object

Description

Row names are also considered a column for the output.

Usage

propose_column_widths(
  x,
  indent_size = 2,
  fontspec = font_spec(),
  round_type = c("iec", "sas")
)

Arguments

x

(ANY)
a MatrixPrintForm object, or an object with a matrix_form method.

indent_size

(numeric(1))
indent size, in characters. Ignored when x is already a MatrixPrintForm object in favor of information there.

fontspec

(font_spec)
a font_spec object specifying the font information to use for calculating string widths and heights, as returned by font_spec().

round_type

("iec" or "sas")
the type of rounding to perform. iec, the default, peforms rounding compliant with IEC 60559 (see details), while sas performs nearest-value rounding consistent with rounding within SAS.

Value

A vector of column widths based on the content of x for use in printing and pagination.

Examples

mf <- basic_matrix_form(mtcars)
propose_column_widths(mf)


formatters documentation built on April 11, 2025, 5:48 p.m.