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,
escape.pipe = st_options('escape.pipe'), …)
One of “pander”, “viewer”, “browser”, or
“render”. For print()
, default is “pander”; for
view()
, default is “viewer”. If “viewer” is used
outside RStudio, “browser” will be used instead. Use
“render” if function is called from an Rmd document.
File name to write output to. Defaults to “”.
Logical. When file
argument is supplied, this indicates
whether to append output to existing file. FALSE
by default.
For html reports, this goes into the
<title>
tag. Defaults to NA
, in which case <title>
will be generic.
Character. Additional classes to assign to output
tables. All Bootstrap css classes can be used. It also allows
user-defined classes (see custom.css parameter). See details
section. NA
by default.
Logical. Set to FALSE
to omit
Bootstrap css. TRUE
by default. To change this default value
globally, see st_options
.
Path to a user-defined .css file. Classes defined in
this file can be used in the table.classes
parameter. NA
by
default. To change this default value globally, see
st_options
.
Hide console messages (such as ignored variables or NaN
to NA
transformations).
footnote in html output. When set to “default”,
this is the package name and version, R version, and current date). Has no
effect when method
is “pander”. Set to “default”,
provide your own text, or set to NA
to omit. To change this default
value globally, see st_options
.
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. Has no effect when method
is
“pander”. Inf
by default.
Logical. Set to TRUE
when using 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. To change
this default value globally, see st_options
.
Additional arguments can be used to override parameters stored as attributes in the object being printed. See Details section.
NULL
when method="pander"
; a file path (returned
invisibly) when method="viewer"
or method="browser"
. In the
latter case, the file path is also passed to shell.exec
so the
document is opened in default Web Browser.
Plain ascii and rmarkdown tables are generated via
pander
. See References section
for a list of all available pander options.
The following additional arguments can be used to override formatting attributes stored in the object to be printed. Refer to the function's documentation for details on these arguments.
style
round.digits
(except for dfSummary
objects)
plain.ascii
justify
headings
display.labels
varnumbers
(dfSummary
objects)
labels.col
(dfSummary
objects)
graph.col
(dfSummary
objects)
valid.col
(dfSummary
objects)
na.col
(dfSummary
objects)
col.widths
(dfSummary
objects)
split.tables
report.nas
(freq
objects)
display.type
(freq
objects)
missing
(freq
objects)
The following additional arguments can be used to override heading elements to be printed:
RStudio Summarytools on GitHub List of pander options on GitHub 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