Global Options for the data.table Package
data.table-options.Rd
The data.table package uses a number of global options to control its behavior. These are regular R options that can be set with options() and retrieved with getOption(). For example:
# Get the current value of an option
getOption("datatable.print.topn")
# Set a new value for an option
options(datatable.print.topn = 10)
This page provides a comprehensive, up-to-date list of all user-configurable options. NB: If you're reading this on the web, make sure the version numbers match with what you have installed.
Printing Options
See print.data.table
for a full description of printing data.tables.
datatable.print.topn
An integer, default
5L
. When a data.table is printed, only the first topn and last topn rows are displayed.datatable.print.nrows
An integer, default
100L
. The total number of rows to print before the topn logic is triggered.datatable.print.class
A logical, default
FALSE
. IfTRUE
, the class of each column is printed below its name.datatable.print.keys
A logical, default
FALSE
. IfTRUE
, the table's keys are printed above the data.datatable.show.indices
A logical, default
TRUE
. A synonym fordatatable.print.keys
for historical reasons.datatable.print.trunc.cols
A logical, default
FALSE
. IfTRUE
and a table has more columns than fit on the screen, it truncates the middle columns.datatable.prettyprint.char
An integer, default
100L
. The maximum number of characters to display in a character column cell before truncating.datatable.print.colnames
A logical, default
TRUE
. IfTRUE
, prints column names.datatable.print.rownames
A logical, default
TRUE
. IfTRUE
, prints row numbers.
File I/O Options (fread and fwrite)
See fread
and fwrite
for a full description of data.table I/O.
datatable.fread.input.cmd.message
A logical, default
TRUE
. IfTRUE
,fread
will print the shell command it is using when the input is a command (e.g.,fread("grep ...")
).datatable.fread.datatable
A logical, default
TRUE
. IfTRUE
,fread
returns adata.table
. IfFALSE
, it returns adata.frame
.datatable.integer64
A character string, default
"integer64"
. Controls howfread
handles 64-bit integers. Can be "integer64", "double", or "character".datatable.logical01
A logical, default
FALSE
. IfTRUE
,fread
will interpret columns containing only 0 and 1 as logical.datatable.keepLeadingZeros
A logical, default
FALSE
. IfTRUE
,fread
preserves leading zeros in character columns by reading them as strings; otherwise they may be coerced to numeric.datatable.logicalYN
A logical, default
FALSE
. IfTRUE
,fread
will interpret "Y" and "N" as logical.datatable.na.strings
A character vector, default
"NA"
. Global default for strings thatfread
should interpret asNA
.datatable.fwrite.sep
A character string, default
","
. The default separator used byfwrite
.datatable.showProgress
An integer or logical, default
interactive()
. Controls whether long-running operations likefread
display a progress bar.
Join and Subset Options
datatable.allow.cartesian
A logical, default
FALSE
. Controls the default value of theallow.cartesian
parameter; seedata.table
. If the value of this parameter is FALSE, an error is raised as a safeguard against an explosive Cartesian join.datatable.join.many
A logical. Stub description to be embellished later in PR #4370.
Performance and Indexing Options
datatable.auto.index
A logical, default
TRUE
. IfTRUE
,data.table
automatically creates a secondary index on-the-fly when a column is first used in a subset, speeding up all subsequent queries.datatable.use.index
A logical, default
TRUE
. A global switch to control whether existing secondary indices are used for subsetting.datatable.forder.auto.index
A logical, default
TRUE
. Similar todatatable.auto.index
, but applies to ordering operations (forder
).datatable.optimize
A numeric, default
Inf
. Controls the GForce query optimization engine. The default enables all possible optimizations. Seedatatable.optimize
.datatable.alloccol
An integer, default
1024L
. Controls the number of column slots to pre-allocate, improving performance when adding many columns. Seealloc.col
.datatable.reuse.sorting
A logical, default
TRUE
. IfTRUE
,data.table
can reuse the sorted order of a table in joins, improving performance.
Development and Verbosity Options
datatable.quiet
A logical, default
FALSE
. The master switch to suppress alldata.table
status messages, including the startup message.datatable.verbose
A logical, default
FALSE
. IfTRUE
,data.table
will print detailed diagnostic information as it processes a query.datatable.enlist
Experimental feature. Default is
NULL
. If set to a function (e.g.,list
), thej
expression can return alist
, which will then be "enlisted" into columns in the result.