Learn R Programming

ordr (version 0.2.0)

format: Format a tbl_ord for printing

Description

These methods of base::format() and base::print() render a (usually more) tidy readout of a tbl_ord that is consistent across all original ordination classes.

Usage

# S3 method for tbl_ord
format(
  x,
  width = NULL,
  ...,
  n = NULL,
  max_extra_cols = NULL,
  max_footer_lines = NULL
)

# S3 method for tbl_ord print( x, width = NULL, ..., n = NULL, max_extra_cols = NULL, max_footer_lines = NULL )

Value

The format() method returns a vector of strings that are more elegantly printed by the print() method, which itself returns the tbl_ord invisibly.

Arguments

x

A tbl_ord.

width

Width of text output to generate. This defaults to NULL, which means use the width option.

...

Additional arguments.

n

Number(s) of rows to show from each matrix factor, handled as by tibble::format.tbl(). If length 1, will apply to both matrix factors. To pass NULL to only one factor, be sure to pass as a list, e.g. n = list(6, NULL).

max_extra_cols

Number of extra columns to print abbreviated information for, if the width is too small for the entire tibble. If NULL, the max_extra_cols option is used. The previously defined n_extra argument is soft-deprecated.

max_footer_lines

Maximum number of footer lines. If NULL, the max_footer_lines option is used.

Details

The format and print methods for class 'tbl_ord' are adapted from those for class 'tbl_df' and for class 'tbl_graph' from the tidygraph package.

Note: The format() function is tedius but cannot be easily modularized without invoking recoverers, annotation, and augmentation multiple times, thereby significantly reducing performance.

Examples

Run this code
iris_pca <- ordinate(iris[1:4], prcomp)

# single value applies to both factors
print(iris_pca, n = 10)

# double values apply to factors in order
print(iris_pca, n = c(6, 2))

# use `list()` to pass `NULL` (for default) to only one factor
print(iris_pca, n = list(2, NULL))
print(iris_pca, n = list(NULL, 2))

Run the code above in your browser using DataLab