Display summarytools
objects in the console, in Web Browser or in
RStudio's Viewer, or write content to file.
# S3 method for summarytools
print(x, method = "pander", file = "",
append = FALSE, report.title = NA, table.classes = NA,
bootstrap.css = st_options('bootstrap.css'),
custom.css = st_options('custom.css'), silent = FALSE,
footnote = st_options('footnote'), max.tbl.height = Inf,
collapse = 0, escape.pipe = st_options("escape.pipe"), …)
Character. One of “pander”, “viewer”,
“browser”, or “render”. Default value for the print()
method is “pander”; for view()
/stview()
, default is
“viewer” if session is running in RStudio, “browser”
otherwise. The main use for “render” is in R Markdown
documents.
Character. File name to write output to. Defaults to “”.
Logical. Append output to existing file (specified using the
file argument). FALSE
by default.
Character. For html reports, this goes into the
<title>
tag. When left to NA
(default), the first line of the
heading section is used (e.g.: “Data Frame Summary”).
Character. Additional html classes to assign to
output tables. Bootstrap css classes can be used. User-defined
classes (see the custom.css argument) are also specified here. See
details section. NA
by default.
Logical. When generating an html document,
include the “includes/stylesheets/bootstrap.min.css"” file
content inside a <style type="text/css">
tag in the document's
<head>
. TRUE
by default. Can be set globally with
st_options
.
Character. Path to a custom .css file. Classes
defined in this must also appear in the table.classes
parameter
in order to be applied to the table(s). Can be set globally with
st_options
. NA
by default.
Logical. Set to TRUE
to hide console messages
(e.g.: ignored variables or NaN
to NA
transformations). FALSE
by default.
Character. Text to display just after html output
tables. The default value (“default”) produces a two-line
footnote indicating the package's name and version, the R version, and
the current date. Has no effect on ascii or markdown
content. Can contain standard html tags. Set to NA
to omit.
Can be set globally with st_options
.
Numeric. Maximum table height in pixels allowed
in rendered dfSummary()
tables. When this argument is used, results
will show up in a <div>
with the specified height and a scroll bar.
Intended to be used in Rmd documents with method = "render"
.
Inf
by default.
Numeric. 0
by default. Set to 1
to make
freq()
sections collapsible (when clicking on the variable name).
Future versions might provide alternate collapsing options.
Logical. Set to TRUE
when style="grid"
and file
argument is supplied if the intent is to generate a text
file that can be converted to other formats using Pandoc. Can be
set globally with st_options
.
NULL
when method="pander"
; A file path returned
invisibly when method="viewer"
or "browser"
. In the
latter case, the file path is also passed to shell.exec
(Windows) or system
(*nix), causing
the document to be opened in default Web browser.
Ascii
and markdown tables are generated using
pander
.
The following arguments can be used to override formatting attributes stored in the object:
style
round.digits
(except for dfSummary objects)
plain.ascii
justify
split.tables
headings
display.labels
varnumbers
(dfSummary
objects only)
labels.col
(dfSummary
objects only)
graph.col
(dfSummary
objects only)
valid.col
(dfSummary
objects only)
na.col
(dfSummary
objects only)
col.widths
(dfSummary
objects only)
keep.grp.vars
(dfSummary
objects only)
report.nas
(freq
objects only)
display.type
(freq
objects only)
missing
(freq
objects only)
The following arguments can be used to override heading elements:
RStudio Summarytools on GitHub List of pander options Bootstrap Cascading Stylesheets
# NOT RUN {
data(tobacco)
view(dfSummary(tobacco), footnote = NA)
# }
# NOT RUN {
data(exams)
print(freq(exams$gender), style = 'rmarkdown')
print(descr(exams), headings = FALSE)
# }
Run the code above in your browser using DataLab