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.

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

# S3 method for 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"))
#> # A data frame: 1 × 1 #> a #> <dbl> #> 1 1