Description Usage Arguments Package options Examples
maturing
One of the main features of the tbl_df
class is the printing:
Tibbles only print as many rows and columns as fit on one screen, supplemented by a summary of the remaining rows and columns.
Tibble reveals the type of each column, which keeps the user informed about
whether a variable is, e.g., <chr>
or <fct>
(character versus factor).
Printing can be tweaked for a one-off call by calling print()
explicitly
and setting arguments like n
and width
. More persistent control is
available by setting the options described below.
1 2 3 4 5 6 7 |
x |
Object to format or print. |
... |
Other arguments passed on to individual methods. |
n |
Number of rows to show. If |
width |
Width of text output to generate. This defaults to |
n_extra |
Number of extra columns to print abbreviated information for,
if the width is too small for the entire tibble. If |
Options used by the tibble and pillar packages to format and print tbl_df
objects. Used by the formatting workhorse trunc_mat()
and, therefore,
indirectly, by print.tbl()
.
tibble.print_max
: Row number threshold: Maximum number of rows printed.
Set to Inf
to always print all rows. Default: 20.
tibble.print_min
: Number of rows printed if row number threshold is
exceeded. Default: 10.
tibble.width
: Output width. Default: NULL
(use width
option).
tibble.max_extra_cols
: Number of extra columns printed in reduced form.
Default: 100.
pillar.bold
: Use bold font, e.g. for column headers? This currently
defaults to FALSE
, because many terminal fonts have poor support for
bold fonts.
pillar.subtle
: Use subtle style, e.g. for row numbers and data types?
Default: TRUE
.
pillar.subtle_num
: Use subtle style for insignificant digits? Default:
FALSE
, is also affected by the pillar.subtle
option.
pillar.neg
: Highlight negative numbers? Default: TRUE
.
pillar.sigfig
: The number of significant digits that will be printed and
highlighted, default: 3
. Set the pillar.subtle
option to FALSE
to
turn off highlighting of significant digits.
pillar.min_title_chars
: The minimum number of characters for the column
title, default: 15
. Column titles may be truncated up to that width to
save horizontal space. Set to Inf
to turn off truncation of column
titles.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | print(as_tibble(mtcars))
print(as_tibble(mtcars), n = 1)
print(as_tibble(mtcars), n = 3)
print(as_tibble(iris), n = 100)
print(mtcars, width = 10)
mtcars2 <- as_tibble(cbind(mtcars, mtcars), .name_repair = "unique")
print(mtcars2, n = 25, n_extra = 3)
trunc_mat(mtcars)
if (requireNamespace("nycflights13", quietly = TRUE)) {
print(nycflights13::flights, n_extra = 2)
print(nycflights13::flights, width = Inf)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.