Get or set global options affecting functions across quanteda.

quanteda_options(..., reset = FALSE, initialize = FALSE)

Arguments

...

options to be set, as key-value pair, same as options. This may be a list of valid key-value pairs, useful for setting a group of options at once (see examples).

reset

logical; if TRUE, reset all quanteda options to their default values

initialize

logical; if TRUE, reset only the quanteda options that are not already defined. Used for setting initial values when some have been defined previously, such as in `.Rprofile`.

Value

When called using a key = value pair (where key can be a label or quoted character name)), the option is set and TRUE is returned invisibly.

When called with no arguments, a named list of the package options is returned. When called with reset = TRUE as an argument, all arguments are options are reset to their default values, and TRUE is returned invisibly.

Details

Currently available options are:

verbose

logical; if TRUE then use this as the default for all functions with a verbose argument

threads

integer; specifies the number of threads to use in use this as the setting in all functions that uee parallelization

print_dfm_max_ndoc

integer; specifies the number of documents to display when using the defaults for printing a dfm

print_dfm_max_nfeature

integer; specifies the number of features to display when using the defaults for printing a dfm

base_docname

character; stem name for documents that are unnamed when a corpus, tokens, or dfm are created or when a dfm is converted from another object

base_featname

character; stem name for features that are unnamed when they are added, for whatever reason, to a dfm through an operation that adds features

base_featname

character; stem name for features that are unnamed when they are added, for whatever reason, to a dfm through an operation that adds features

base_featname

character; stem name for features that are unnamed when they are added, for whatever reason, to a dfm through an operation that adds features

Examples

(opt <- quanteda_options())
#> $threads #> [1] 7 #> #> $verbose #> [1] FALSE #> #> $print_dfm_max_ndoc #> [1] 20 #> #> $print_dfm_max_nfeature #> [1] 20 #> #> $base_docname #> [1] "text" #> #> $base_featname #> [1] "feat" #> #> $language_stemmer #> [1] "english" #> #> $language_stopwords #> [1] "english" #>
quanteda_options(verbose = TRUE) quanteda_options("verbose" = FALSE) quanteda_options("threads")
#> [1] 7
quanteda_options(print_dfm_max_ndoc = 50L) # reset to defaults quanteda_options(reset = TRUE) # reset to saved options quanteda_options(opt)