tostring: 'toString'

toStringR Documentation

toString

Description

Transform a complex object into a string representation ready to be printed or written to a plain-text file

Usage

toString(x, ...)

## S4 method for signature 'MatrixPrintForm'
toString(
  x,
  widths = NULL,
  tf_wrap = FALSE,
  max_width = NULL,
  col_gap = mf_colgap(x),
  hsep = default_hsep()
)

Arguments

x

ANY. Object to be prepared for rendering.

...

Passed to individual methods.

widths

numeric (or NULL). (proposed) widths for the columns of x. The expected length of this numeric vector can be retrieved with ncol() + 1 as the column of row names must also be considered.

tf_wrap

logical(1). Should the texts for title, subtitle, and footnotes be wrapped?

max_width

integer(1), character(1) or NULL. Width that title and footer (including footnotes) materials should be word-wrapped to. If NULL, it is set to the current print width of the session (getOption("width")). If set to "auto", the width of the table (plus any table inset) is used. Ignored completely if tf_wrap is FALSE.

col_gap

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

hsep

character(1). Characters to repeat to create header/body separator line.

Details

Manual insertion of newlines is not supported when tf_wrap is on and will result in a warning and undefined wrapping behavior. Passing vectors of already split strings remains supported, however in this case each string is word-wrapped separately with the behavior described above.

Value

A character string containing the ASCII rendering of the table-like object represented by x

Examples

mform <- basic_matrix_form(mtcars)
cat(toString(mform))


formatters documentation built on Aug. 25, 2023, 5:18 p.m.