st_options | R Documentation |
To list all summarytools
global options, call without arguments. To
display the value of one or several options, enter the name(s) of the
option(s) in a character vector as sole argument. To reset all
options, use single unnamed argument ‘reset’ or 0
.
st_options( option = NULL, value = NULL, style = "simple", plain.ascii = TRUE, round.digits = 2, headings = TRUE, footnote = "default", display.labels = TRUE, bootstrap.css = TRUE, custom.css = NA_character_, escape.pipe = FALSE, char.split = 12, freq.cumul = TRUE, freq.totals = TRUE, freq.report.nas = TRUE, freq.ignore.threshold = 25, freq.silent = FALSE, ctable.prop = "r", ctable.totals = TRUE, ctable.round.digits = 1, descr.stats = "all", descr.transpose = FALSE, descr.silent = FALSE, dfSummary.style = "multiline", dfSummary.varnumbers = TRUE, dfSummary.labels.col = TRUE, dfSummary.valid.col = TRUE, dfSummary.na.col = TRUE, dfSummary.graph.col = TRUE, dfSummary.graph.magnif = 1, dfSummary.silent = FALSE, dfSummary.custom.1 = expression(paste(paste0(trs("iqr"), " (", trs("cv"), ") : "), format_number(IQR(column_data, na.rm = TRUE), round.digits), " (", format_number(sd(column_data, na.rm = TRUE)/mean(column_data, na.rm = TRUE), round.digits), ")", collapse = "", sep = "")), dfSummary.custom.2 = NA, tmp.img.dir = NA_character_, subtitle.emphasis = TRUE, lang = "en", use.x11 = TRUE )
option |
option(s) name(s) to query (optional). Can be a single string or a vector of strings to query multiple values. |
value |
The value you wish to assign to the option specified in the
first argument. This is for backward-compatibility, as all options can now
be set via their own parameter. That is, instead of
|
style |
Character. One of “simple” (default), “rmarkdown”,
or “grid”. Does not apply to |
plain.ascii |
Logical. |
round.digits |
Numeric. Defaults to |
headings |
Logical. Set to |
footnote |
Character. When the default value “default” is used,
the package name & version, as well as the R version number are displayed
below html outputs. Set no |
display.labels |
Logical. |
bootstrap.css |
Logical. Specifies whether to include
Bootstrap css in html reports' head section.
Defaults to |
custom.css |
Character. Path to an additional, user-provided, CSS file.
|
escape.pipe |
Logical. Set to |
char.split |
Numeric. Maximum number of characters allowed in a column
heading for |
freq.cumul |
Logical. Corresponds to the |
freq.totals |
Logical. Corresponds to the |
freq.report.nas |
Logical. Corresponds to the |
freq.ignore.threshold |
Numeric. Number of distinct values above which
numerical variables are ignored when calling |
freq.silent |
Logical. Hide console messages. |
ctable.prop |
Character. Corresponds to the |
ctable.totals |
Logical. Corresponds to the |
ctable.round.digits |
Numeric. Defaults to |
descr.stats |
Character. Corresponds to the |
descr.transpose |
Logical. Corresponds to the |
descr.silent |
Logical. Hide console messages. |
dfSummary.style |
Character. “multiline” by default. Set to “grid” for R Markdown documents. |
dfSummary.varnumbers |
Logical. In |
dfSummary.labels.col |
Logical. In |
dfSummary.valid.col |
Logical. In |
dfSummary.na.col |
Logical. In |
dfSummary.graph.col |
Logical. Display barplots / histograms column in
|
dfSummary.graph.magnif |
Numeric. Magnification factor, useful if
|
dfSummary.silent |
Logical. Hide console messages. |
dfSummary.custom.1 |
Expression. First of two optional expressions
which once evaluated will populate lines 3+ of the 'Stats / Values'
cell when column data is numerical and has more distinct values than
allowed by the |
dfSummary.custom.2 |
Expression. Second the two optional expressions
which once evaluated will populate lines 3+ of the 'Stats / Values'
cell when the column data is numerical and has more distinct values than
allowed by the 'max.distinct.values' parameter. |
tmp.img.dir |
Character. Directory used to store temporary images. See
Details section of |
subtitle.emphasis |
Logical. Controls the formatting of the
“subtitle” (the data frame or variable name, depending
on context. When |
lang |
Character. A 2-letter code for the language to use in the produced outputs. Currently available languages are: ‘en’, ‘es’, ‘fr’, ‘pt’, ‘ru’, and ‘tr’. |
use.x11 |
Logical. TRUE by default. In console-only environments,
setting this to |
The dfSummary.custom.1
and dfSummary.custom.2
options
must be defined as expressions. In the expression, use the
culumn_data
variable name to refer to data. Assume the type to be
numerical (real or integer). The expression must paste together both the
labels (short name for the statistic(s) being displayed) and the
statistics themselves. Although round
can be used, a
better alternative is to call the internal format_number
,
which uses format
to apply all relevant formatting
that is active within the call to dfSummary
. For keywords
having a translated term, the trs()
internal function can be
used (see Examples).
To learn more about summarytools options, see
vignette("introduction", "summarytools")
.
# show all summarytools global options st_options() # show a specific option st_options("round.digits") # show two (or more) options st_options(c("plain.ascii", "style", "footnote")) ## Not run: # set one option st_options(plain.ascii = FALSE) # set one options, legacy way st_options("plain.ascii", FALSE) # set several options st_options(plain.ascii = FALSE, style = "rmarkdown", footnote = NA) # reset all st_options('reset') # ... or st_options(0) # Define custom dfSummary stats st_options(dfSummary.custom.1 = expression( paste( "Q1 - Q3 :", format_number( quantile(column_data, probs = .25, type = 2, names = FALSE, na.rm = TRUE), round.digits ), "-", format_number( quantile(column_data, probs = .75, type = 2, names = FALSE, na.rm = TRUE), round.digits ), collapse = "" ) )) dfSummary(iris) # Set back to default value st_options(dfSummary.custom.1 = "default") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.