
tableby
objectThe summary method for a tableby
object, which is a pretty rendering of a tableby
object into a publication-quality results table in R Markdown, and can render well in text-only.
# S3 method for tableby
summary(
object,
...,
labelTranslations = NULL,
text = FALSE,
title = NULL,
pfootnote = FALSE,
term.name = ""
)# S3 method for summary.tableby
as.data.frame(
x,
...,
text = x$text,
pfootnote = x$pfootnote,
term.name = x$term.name,
width = NULL,
min.split = NULL,
list.ok = FALSE
)
An object of class "tableby"
, made by the tableby
function.
For summary.tableby
, other arguments passed to as.data.frame.tableby
.
For print
ing the summary object, these are passed to both as.data.frame.summary.tableby
and
kable
.
A named list (or vector) where the name is the label in the
output to be replaced in the pretty rendering by the character string
value for the named element of the list, e.g., list(age = "Age(Years)", meansd = "Mean(SD)")
.
An argument denoting how to print the summary to the screen.
Default is FALSE
(show markdown output). TRUE
and NULL
output a text-only version, with
the latter avoiding all formatting.
"html"
uses the HTML tag <strong>
instead of the markdown formatting, and "latex"
uses
the LaTeX command \textbf
.
Title/caption for the table, defaulting to NULL
(no title). Passed to kable
.
Can be length > 1 if the more than one table is being printed.
Logical, denoting whether to put footnotes describing the tests used to generate the p-values. Alternatively,
"html" to surround the outputted footnotes with <li>
.
A character vector denoting the column name for the "terms" column. It should be the same length
as the number of tables or less (it will get recycled if needed). The special value TRUE
will
use the y-variable's label for each table.
An object of class "summary.tableby"
.
Passed to smart.split
for formatting of the "term" column.
Passed to smart.split
for formatting of the "term" column.
If the object has multiple by-variables, is it okay to return a list of data.frames instead of a single data.frame?
If FALSE
but there are multiple by-variables, a warning is issued.
An object of class summary.tableby
# NOT RUN {
set.seed(100)
## make 3+ categories for response
nsubj <- 90
mdat <- data.frame(Response=sample(c(1,2,3),nsubj, replace=TRUE),
Sex=sample(c("Male", "Female"), nsubj,replace=TRUE),
Age=round(rnorm(nsubj,mean=40, sd=5)),
HtIn=round(rnorm(nsubj,mean=65,sd=5)))
## allow default summaries on RHS variables
out <- tableby(Response ~ Sex + Age + HtIn, data=mdat)
summary(out, text=TRUE)
labels(out)
labels(out) <- c(Age="Age (years)", HtIn="Height (inches)")
summary(out, stats.labels=c(meansd="Mean-SD", q1q3 = "Q1-Q3"), text=TRUE)
# }
Run the code above in your browser using DataLab