Transform rtable to a list of matrices which can be used for outputting
Source: R/generics.R
matrix_form.RdAlthough rtables are represented as a tree data structure when outputting the table to ASCII or HTML,
it is useful to map the rtable to an in-between state with the formatted cells in a matrix form.
Usage
matrix_form(
obj,
indent_rownames = FALSE,
expand_newlines = TRUE,
indent_size = 2,
fontspec = NULL,
col_gap = NULL,
round_type = obj_round_type(obj)
)
# S4 method for class 'MatrixPrintForm'
matrix_form(
obj,
indent_rownames = FALSE,
expand_newlines = TRUE,
indent_size = 2,
fontspec = NULL,
col_gap = NULL,
round_type = obj_round_type(obj)
)Arguments
- obj
(
ANY)
object to be transformed into a ready-to-render form (aMatrixPrintFormobject).- indent_rownames
(
flag)
ifTRUE, the row names column in thestringsmatrix ofobjwill have indented row names (strings pre-fixed).- expand_newlines
(
flag)
whether the generated matrix form should expand rows whose values contain newlines into multiple 'physical' rows (as they will appear when rendered into ASCII). Defaults toTRUE.- indent_size
(
numeric(1))
number of spaces to be used per level of indent (if supported by the relevant method). Defaults to 2.- fontspec
(
font_spec)
a font_spec object specifying the font information to use for calculating string widths and heights, as returned byfont_spec().- col_gap
(
numeric(1))
the gap to be assumed between columns, in number of spaces with font specified byfontspec.- 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).
Value
A MatrixPrintForm classed list with an additional nrow_header attribute indicating the
number of pseudo "rows" the column structure defines, with the following elements:
stringsThe content, as it should be printed, of the top-left material, column headers, row labels, and cell values of
tt.spansThe column-span information for each print-string in the strings matrix.
alignsThe text alignment for each print-string in the strings matrix.
displayWhether each print-string in the strings matrix should be printed or not.
row_infoThe
data.framegenerated bybasic_pagdf().