View source: R/textTable_methods.bare.R
textTable.table | R Documentation |
texttable
from a table
or xtabs
Object Create a textTable
object representing a flattened multiway
contingency table.
## S3 method for class 'table'
textTable(x, colheadLabels=c("layers", "none", "paste"), sep=": ",
title=character(0), subtitle=character(0), foot=character(0), ...)
x |
A |
colheadLabels |
Character scalar; how to display names of column header variables. "none"
means to not display them. "layers" (the default) means to display them
as additional column header layers (so each header variable occupies two
rows instead of one). "paste" means to paste the variable name in front
of each of its values, separated by |
sep |
Character scalar; string that separates a variable name from its values
when |
title , subtitle , foot |
Optional character vectors providing annotation for the table. May be
empty (i.e., |
... |
Additional arguments passed to |
This function simply converts x
to an ftable
(flattened
multiway contingency table), then applies the corresponding
textTable
method to that object.
It also works for xtabs
objects since they inherit from
table
.
An object with S3 class textTable
. See the documentation for the
generic for details about its structure.
ftable
, xtabs
# UCBAdmissions is a contingency table in array form ('table' object).
data(UCBAdmissions, package="datasets")
ttbl <- textTable(UCBAdmissions)
plot(ttbl, title=c("Plotting a 'table' object:", "UCB Admissions data"))
# Method also works for 'xtabs' since they inherit from 'table' (example
# from '?xtabs'):
data(warpbreaks, package="datasets")
warpbreaks$replicate <- rep_len(1:9, 54)
xt <- xtabs(breaks ~ wool + tension + replicate, data = warpbreaks)
ttbl <- textTable(xt, title="Plotting an 'xtabs' object (warpbreaks data)")
plot(ttbl)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.