Skip to content

Commit fe837d4

Browse files
add doc page for data.table options
1 parent 5483d48 commit fe837d4

File tree

1 file changed

+155
-0
lines changed

1 file changed

+155
-0
lines changed

man/data.table-options.Rd

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
\name{data.table-options}
2+
\alias{data.table-options}
3+
\alias{data.table.options}
4+
5+
\title{Global Options for the data.table Package}
6+
7+
\description{
8+
The data.table package uses a number of global options to control its
9+
behavior. These are regular R options that can be set with options()
10+
and retrieved with getOption().
11+
12+
This page provides a comprehensive, up-to-date list of all user-configurable
13+
options.
14+
}
15+
16+
\usage{
17+
\preformatted{
18+
# Get the current value of an option
19+
getOption("datatable.print.topn")
20+
21+
# Set a new value for an option
22+
options(datatable.print.topn = 10)
23+
}
24+
}
25+
26+
\section{Printing Options}{
27+
\details{
28+
\describe{
29+
\item{\code{datatable.print.topn}}{An integer. When a data.table is printed,
30+
only the first topn and last topn rows are displayed. This prevents
31+
cluttering the console for large tables.
32+
Default: \code{5L}. See \code{\link{print.data.table}}.}
33+
\item{\code{datatable.print.nrows}}{An integer. The total number of rows
34+
to print before the topn logic is triggered.
35+
Default: \code{100L}.}
36+
\item{\code{datatable.print.class}}{A logical. If \code{TRUE}, the class of
37+
each column is printed below the column name.
38+
Default: \code{FALSE}.}
39+
\item{\code{datatable.print.keys}}{A logical. If \code{TRUE}, the table's
40+
keys are printed above the data.
41+
Default: \code{FALSE}.}
42+
\item{\code{datatable.print.trunc.cols}}{A logical. If \code{TRUE} and a
43+
table has more columns than fit on the screen, it truncates the middle
44+
columns for printing (e.g., a, b, ..., z). If \code{FALSE}, it wraps
45+
the columns to the next line.
46+
Default: \code{FALSE}.}
47+
\item{\code{datatable.prettyprint.char}}{An integer. The maximum number of
48+
characters to display in a character column cell before truncating
49+
with ....
50+
Default: \code{100L}.}
51+
}
52+
}
53+
54+
\section{File I/O Options (fread and fwrite)}{
55+
\describe{
56+
\item{\code{datatable.fread.input.cmd.message}}{A logical. If \code{TRUE},
57+
fread will print the shell command it is using when the input is a
58+
command (e.g., fread("grep ...")).
59+
Default: \code{TRUE}. See \code{\link{fread}}.}
60+
\item{\code{datatable.fread.datatable}}{A logical. If \code{TRUE}, fread
61+
returns a data.table. If FALSE, it returns a data.frame.
62+
Default: \code{TRUE}.}
63+
\item{\code{datatable.integer64}}{A character string. Controls how fread
64+
handles 64-bit integers. Can be "integer64" (requires bit64 package),
65+
"double" (loses precision), or "character" (reads as text).
66+
Default: \code{"integer64"}.}
67+
\item{\code{datatable.logical01}}{A logical. If \code{TRUE}, fread will
68+
interpret columns containing only 0 and 1 as logical FALSE/TRUE.
69+
Default: \code{FALSE}.}
70+
\item{\code{datatable.showProgress}}{An integer or logical. Controls whether
71+
long-running operations like fread display a progress bar. Default
72+
is \code{interactive()}, showing it only in interactive R sessions.}
73+
}
74+
}
75+
76+
\section{Join and Subset Options}{
77+
\describe{
78+
\item{\code{datatable.allow.cartesian}}{A logical. A safety feature to prevent
79+
accidental memory-exploding joins. If FALSE (default), a join is not
80+
allowed if the result would be more rows than max(nrow(x), nrow(i)),
81+
which occurs when a row in i matches more than one row in x.
82+
Default: \code{FALSE}. See \code{\link{data.table}}.}
83+
\item{\code{datatable.nomatch}}{Controls the behavior of non-matching rows in
84+
a join. The default is NA, which returns NA for columns of x when a
85+
row in i has no match. Can be set to 0L to drop non-matching rows,
86+
behaving like an inner join.
87+
Default: \code{NA}.}
88+
}
89+
}
90+
91+
\section{Performance and Indexing Options}{
92+
\describe{
93+
\item{\code{datatable.auto.index}}{A logical. If \code{TRUE}, data.table
94+
automatically creates a secondary index on-the-fly the first time a column
95+
is used in a query (e.g., DT[col == 'value']). This dramatically
96+
speeds up all subsequent queries on that same column.
97+
Default: \code{TRUE}.}
98+
\item{\code{datatable.use.index}}{A logical. A global switch to control
99+
whether existing indices are used for subsetting.
100+
Default: \code{TRUE}.}
101+
\item{\code{datatable.optimize}}{An integer controlling the GForce query
102+
optimization engine. Set to Inf to enable all possible optimizations,
103+
which data.table does by default. See \code{\link{datatable.optimize}}.
104+
Default: \code{Inf}.}
105+
\item{\code{datatable.alloccol}}{An integer. data.table pre-allocates
106+
memory for a certain number of columns when first created. This option
107+
controls the length of this pre-allocation, improving performance when
108+
adding many columns via :=. See \code{\link{alloc.col}}.
109+
Default: \code{1024L}.}
110+
}
111+
}
112+
113+
\section{Development and Verbosity Options}{
114+
\describe{
115+
\item{\code{datatable.verbose}}{A logical. If \code{TRUE}, data.table will
116+
print detailed, step-by-step diagnostic information as it processes a
117+
query. Extremely useful for debugging and performance tuning.
118+
Default: \code{FALSE}.}
119+
\item{\code{datatable.pedantic}}{A logical. If \code{TRUE}, data.table
120+
enters a "pedantic" mode, issuing helpful warnings for situations that
121+
are not technically errors but might be unintentional (e.g., when a
122+
variable in j is found in the global environment instead of inside the
123+
data.table).
124+
Default: \code{FALSE}.}
125+
\item{\code{datatable.dfdispatchwarn}}{A logical. If \code{TRUE}, warns
126+
when a generic function from another package (e.g., dplyr::filter) is
127+
applied to a data.table. This can be a useful reminder that you are not
128+
using data.table's optimized methods.
129+
Default: \code{TRUE}.}
130+
}
131+
}
132+
133+
\section{Internal Strings (Not User Options)}{
134+
\describe{
135+
\item{The following strings are not options to be set by users.}{They are
136+
included here to assist developers searching the source code. They are typically
137+
parts of URLs found in code comments or documentation.
138+
\itemize{
139+
\item \code{datatable.com}
140+
\item \code{datatable.github.io}
141+
\item \code{datatable.gitlab.io}
142+
}
143+
}
144+
}
145+
}
146+
}
147+
148+
\seealso{
149+
\code{\link{options}},
150+
\code{\link{getOption}},
151+
\code{\link{data.table}}
152+
}
153+
154+
\keyword{data}
155+
\keyword{utilities}

0 commit comments

Comments
 (0)