print_options: Set global printing method for data.table

View source: R/print.R

print_optionsR Documentation

Set global printing method for data.table

Description

This function allow user to define how data.table is printed.

Usage

print_options(
  topn = 5,
  nrows = 100,
  class = TRUE,
  row.names = TRUE,
  col.names = "auto",
  print.keys = TRUE,
  trunc.cols = FALSE
)

Arguments

topn

The number of rows to be printed from the beginning and end of tables with more than nrow rows.

nrows

The number of rows which will be printed before truncation is enforced.

class

If TRUE, the resulting output will include above each column its storage class (or a self-evident abbreviation thereof).

row.names

If TRUE, row indices will be printed.

col.names

One of three flavours for controlling the display of column names in output. "auto" includes column names above the data, as well as below the table if nrow(x) > 20. "top" excludes this lower register when applicable, and "none" suppresses column names altogether (as well as column classes if class = TRUE.

print.keys

If TRUE, any key and/or index currently assigned to x will be printed prior to the preview of the data.

trunc.cols

If TRUE, only the columns that can be printed in the console without wrapping the columns to new lines will be printed (similar to tibbles).

Details

Notice that tidyfst has a slightly different printing default for data.table, which is it always prints the keys and variable class (not like data.table).

Value

None. This function is used for its side effect of changing options.

See Also

print.data.table

Examples


iris %>% as.data.table()
print_options(topn = 3,trunc.cols = TRUE)
iris %>% as.data.table()

# set all settings to default in tidyfst
print_options()
iris %>% as.data.table()


tidyfst documentation built on July 26, 2023, 5:20 p.m.