Skip to content

Commit 0440efd

Browse files
simplify setting options in .onLoad
1 parent 0e5f928 commit 0440efd

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

R/onLoad.R

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -73,28 +73,28 @@
7373
# In fread and fwrite we have moved back to using getOption's default argument since it is unlikely fread and fread will be called in a loop many times, plus they
7474
# are relatively heavy functions where the overhead in getOption() would not be noticed. It's only really [.data.table where getOption default bit.
7575
# Improvement to base::getOption() now submitted (100x; 5s down to 0.05s): https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17394
76-
opts = c("datatable.verbose"="FALSE", # datatable.<argument name>
77-
"datatable.optimize"="Inf", # datatable.<argument name>
78-
"datatable.print.nrows"="100L", # datatable.<argument name>
79-
"datatable.print.topn"="5L", # datatable.<argument name>
80-
"datatable.print.class"="TRUE", # for print.data.table
81-
"datatable.print.rownames"="TRUE", # for print.data.table
82-
"datatable.print.colnames"="'auto'", # for print.data.table
83-
"datatable.print.keys"="TRUE", # for print.data.table
84-
"datatable.print.trunc.cols"="FALSE", # for print.data.table
85-
"datatable.show.indices"="FALSE", # for print.data.table
86-
"datatable.allow.cartesian"="FALSE", # datatable.<argument name>
87-
"datatable.join.many"="TRUE", # mergelist, [.data.table #4383 #914
88-
"datatable.dfdispatchwarn"="TRUE", # not a function argument
89-
"datatable.warnredundantby"="TRUE", # not a function argument
90-
"datatable.alloccol"="1024L", # argument 'n' of alloc.col. Over-allocate 1024 spare column slots
91-
"datatable.auto.index"="TRUE", # DT[col=="val"] to auto add index so 2nd time faster
92-
"datatable.use.index"="TRUE", # global switch to address #1422
93-
"datatable.prettyprint.char" = NULL # FR #1091
94-
)
95-
for (i in setdiff(names(opts),names(options()))) {
96-
eval(parse(text=paste0("options(",i,"=",opts[i],")")))
97-
}
76+
opts = list(
77+
datatable.verbose=FALSE, # datatable.<argument name>
78+
datatable.optimize=Inf, # datatable.<argument name>
79+
datatable.print.nrows=100L, # datatable.<argument name>
80+
datatable.print.topn=5L, # datatable.<argument name>
81+
datatable.print.class=TRUE, # for print.data.table
82+
datatable.print.rownames=TRUE, # for print.data.table
83+
datatable.print.colnames='auto', # for print.data.table
84+
datatable.print.keys=TRUE, # for print.data.table
85+
datatable.print.trunc.cols=FALSE, # for print.data.table
86+
datatable.show.indices=FALSE, # for print.data.table
87+
datatable.allow.cartesian=FALSE, # datatable.<argument name>
88+
datatable.join.many=TRUE, # mergelist, [.data.table #4383 #914
89+
datatable.dfdispatchwarn=TRUE, # not a function argument
90+
datatable.warnredundantby=TRUE, # not a function argument
91+
datatable.alloccol=1024L, # argument 'n' of alloc.col. Over-allocate 1024 spare column slots
92+
datatable.auto.index=TRUE, # DT[col=="val"] to auto add index so 2nd time faster
93+
datatable.use.index=TRUE, # global switch to address #1422
94+
datatable.prettyprint.char=NULL # FR #1091
95+
)
96+
opts = opts[!names(opts) %chin% names(options())]
97+
options(opts)
9898

9999
# Test R behaviour that changed in v3.1 and is now depended on
100100
x = 1L:3L

0 commit comments

Comments
 (0)