MatrixPrintForm {formatters}R Documentation

Constructor for Matrix Print Form

Description

Constructor for MatrixPrintForm, an intermediate representation for ASCII table printing.

Usage

MatrixPrintForm(
  strings = NULL,
  spans,
  aligns,
  formats,
  row_info,
  line_grouping = seq_len(NROW(strings)),
  ref_fnotes = list(),
  nlines_header,
  nrow_header,
  has_topleft = TRUE,
  has_rowlabs = has_topleft,
  expand_newlines = TRUE,
  main_title = "",
  subtitles = character(),
  page_titles = character(),
  listing_keycols = NULL,
  main_footer = "",
  prov_footer = character(),
  header_section_div = NA_character_,
  horizontal_sep = default_hsep(),
  col_gap = 3,
  table_inset = 0L,
  colwidths = NULL,
  indent_size = 2
)

Arguments

strings

(⁠character matrix⁠)
matrix of formatted, ready-to-display strings organized as they will be positioned when rendered. Elements that span more than one column must be followed by the correct number of placeholders (typically either empty strings or repeats of the value).

spans

(⁠numeric matrix⁠)
matrix of same dimension as strings giving the spanning information for each element. Must be repeated to match placeholders in strings.

aligns

(⁠character matrix⁠)
matrix of same dimension as strings giving the text alignment information for each element. Must be repeated to match placeholders in strings. Must be a supported text alignment. See decimal_align for allowed values.

formats

(matrix)
matrix of same dimension as strings giving the text format information for each element. Must be repeated to match placeholders in strings.

row_info

(data.frame)
data frame with row-information necessary for pagination (see basic_pagdf() for more details).

line_grouping

(integer)
sequence of integers indicating how print lines correspond to semantic rows in the object. Typically this should not be set manually unless expand_newlines is set to FALSE.

ref_fnotes

(list)
referential footnote information, if applicable.

nlines_header

(numeric(1))
number of lines taken up by the values of the header (i.e. not including the divider).

nrow_header

(numeric(1))
number of rows corresponding to the header.

has_topleft

(flag)
does the corresponding table have "top left information" which should be treated differently when expanding newlines. Ignored if expand_newlines is FALSE.

has_rowlabs

(flag)
do the matrices (strings, spans, aligns) each contain a column that corresponds with row labels (rather than with table cell values). Defaults to TRUE.

expand_newlines

(flag)
whether the matrix form generated should expand rows whose values contain newlines into multiple 'physical' rows (as they will appear when rendered into ASCII). Defaults to TRUE.

main_title

(string)
main title as a string.

subtitles

(character)
subtitles, as a character vector.

page_titles

(character)
page-specific titles, as a character vector.

listing_keycols

(character)
. if matrix form of a listing, this contains the key columns as a character vector.

main_footer

(character)
main footer, as a character vector.

prov_footer

(character)
provenance footer information, as a character vector.

header_section_div

(string)
divider to be used between header and body sections.

horizontal_sep

(string)
horizontal separator to be used for printing divisors between header and table body and between different footers.

col_gap

(numeric(1))
space (in characters) between columns.

table_inset

(numeric(1))
table inset. See table_inset().

colwidths

(numeric or NULL)
column rendering widths. If non-NULL, must have length equal to ncol(strings).

indent_size

(numeric(1))
number of spaces to be used per level of indent (if supported by the relevant method). Defaults to 2.

Value

An object of class MatrixPrintForm. Currently this is implemented as an S3 class inheriting from list with the following elements:

strings

see argument.

spans

see argument.

aligns

see argument.

display

logical matrix of same dimension as strings that specifies whether an element in strings will be displayed when the table is rendered.

formats

see argument.

row_info

see argument.

line_grouping

see argument.

ref_footnotes

see argument.

main_title

see argument.

subtitles

see argument.

page_titles

see argument.

main_footer

see argument.

prov_footer

see argument.

header_section_div

see argument.

horizontal_sep

see argument.

col_gap

see argument.

table_inset

see argument.

as well as the following attributes:

nlines_header

see argument.

nrow_header

see argument.

ncols

number of columns of the table, not including any row names/row labels

Note

The bare constructor for the MatrixPrintForm should generally only be called by matrix_form custom methods, and almost never from other code.

Examples

basic_matrix_form(iris) # calls matrix_form which calls this constructor


[Package formatters version 0.5.6 Index]