Skip to contents

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. If TRUE, the class of each column is printed below its name.

datatable.print.keys

A logical, default FALSE. If TRUE, the table's keys are printed above the data.

datatable.show.indices

A logical, default TRUE. A synonym for datatable.print.keys for historical reasons.

datatable.print.trunc.cols

A logical, default FALSE. If TRUE 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. If TRUE, prints column names.

datatable.print.rownames

A logical, default TRUE. If TRUE, 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. If TRUE, 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. If TRUE, fread returns a data.table. If FALSE, it returns a data.frame.

datatable.integer64

A character string, default "integer64". Controls how fread handles 64-bit integers. Can be "integer64", "double", or "character".

datatable.logical01

A logical, default FALSE. If TRUE, fread will interpret columns containing only 0 and 1 as logical.

datatable.keepLeadingZeros

A logical, default FALSE. If TRUE, 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. If TRUE, fread will interpret "Y" and "N" as logical.

datatable.na.strings

A character vector, default "NA". Global default for strings that fread should interpret as NA.

datatable.fwrite.sep

A character string, default ",". The default separator used by fwrite.

datatable.showProgress

An integer or logical, default interactive(). Controls whether long-running operations like fread display a progress bar.

Join and Subset Options

datatable.allow.cartesian

A logical, default FALSE. Controls the default value of the allow.cartesian parameter; see data.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. If TRUE, 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 to datatable.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. See datatable.optimize.

datatable.alloccol

An integer, default 1024L. Controls the number of column slots to pre-allocate, improving performance when adding many columns. See alloc.col.

datatable.reuse.sorting

A logical, default TRUE. If TRUE, 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 all data.table status messages, including the startup message.

datatable.verbose

A logical, default FALSE. If TRUE, 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), the j expression can return a list, which will then be "enlisted" into columns in the result.