Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

format_tbl

Formatting of tbl objects


Description

These functions and methods are responsible for printing objects of the "tbl" class, which includes tibbles and dbplyr lazy tables. See tibble::formatting for user level documentation, and vignette("customization") for details.

While it is possible to implement a custom format() or print() method for your tibble-like objects, it should never be necessary if your class inherits from "tbl". In this case, the default methods offer many customization options at every level of detail. This means you only need to override or extend implementations for the parts that need change.

The output uses color and highlighting according to the "cli.num_colors" option. Set it to 1 to suppress colored and highlighted output.

Usage

## S3 method for class 'tbl'
print(x, width = NULL, ..., n = NULL, n_extra = NULL)

## S3 method for class 'tbl'
format(x, width = NULL, ..., n = NULL, n_extra = NULL)

Arguments

x

Object to format or print.

width

Width of text output to generate. This defaults to NULL, which means use getOption("tibble.width") or (if also NULL) getOption("width"); the latter displays only the columns that fit on one screen. You can also set options(tibble.width = Inf) to override this default and always print all columns.

...

Passed on to tbl_format_setup().

n

Number of rows to show. If NULL, the default, will print all rows if less than option tibble.print_max. Otherwise, will print tibble.print_min rows.

n_extra

Number of extra columns to print abbreviated information for, if the width is too small for the entire tibble. If NULL, the default, the value of the tibble.max_extra_cols option is used.

See Also

Examples

print(vctrs::new_data_frame(list(a = 1), class = "tbl"))

pillar

Coloured Formatting for Columns

v1.6.0
MIT + file LICENSE
Authors
Kirill Müller [aut, cre], Hadley Wickham [aut], RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.