Propose column widths based on the MatrixPrintForm of an object
Source: R/tostring.R
propose_column_widths.RdRow names are also considered a column for the output.
Usage
propose_column_widths(
x,
indent_size = 2,
fontspec = font_spec(),
round_type = obj_round_type(x)
)Arguments
- x
(
ANY)
aMatrixPrintFormobject, or an object with amatrix_formmethod.- indent_size
(
numeric(1))
indent size, in characters. Ignored whenxis already aMatrixPrintFormobject 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 byfont_spec().- round_type
(
string)
.
The type of rounding to perform. Allowed values: ("iec","iec_mod"or"sas")
iec, the default, and iec_mod performs rounding compliant with IEC 60559 (see notes inround_fmt()), while sas performs nearest-value rounding consistent with rounding within SAS.
In addition, the rounding of a negative number that rounds to zero will be presented as 0 (with the appropriate number of trailing zeros) for bothsasandiec_mod, while foriec, it will be presented as -0 (with the appropriate number of trailing zeros).
Examples
mf <- basic_matrix_form(mtcars)
propose_column_widths(mf)
#> rnms mpg cyl disp hp drat wt qsec vs am gear carb
#> 19 4 3 5 3 4 5 5 2 2 4 4