Usage
sjt.xtab(var.row, var.col, weight.by = NULL, title = NULL, var.labels = NULL, value.labels = NULL, wrap.labels = 20, show.obs = TRUE, show.cell.prc = FALSE, show.row.prc = FALSE, show.col.prc = FALSE, show.exp = FALSE, show.summary = TRUE, show.legend = FALSE, show.na = FALSE, string.total = "Total", digits = 1, tdcol.n = "black", tdcol.expected = "#339999", tdcol.cell = "#993333", tdcol.row = "#333399", tdcol.col = "#339933", emph.total = FALSE, emph.color = "#f8f8f8", prc.sign = " %", hundret = "100.0", CSS = NULL, encoding = NULL, file = NULL, use.viewer = TRUE, no.output = FALSE, remove.spaces = TRUE)
Arguments
var.row
variable that should be displayed in the table rows.
var.col
variable that should be displayed in the table columns.
weight.by
weight factor that will be applied to weight all cases.
Must be a vector of same length as the input vector. Default is
NULL
, so no weights are used.
title
table caption. By default, title = NULL
, hence no title will be used.
var.labels
character vector with variable names, which will be used
to label variables in the output.
value.labels
character vector (or list
of character vectors)
with value labels of the supplied variables, which will be used
to label variable values in the output.
wrap.labels
numeric, determines how many chars of the value, variable or axis
labels are displayed in one line and when a line break is inserted.
show.obs
logical, if TRUE
, observed values are shown
show.cell.prc
logical, if TRUE
, cell percentage values are shown
show.row.prc
logical, if TRUE
, row percentage values are shown
show.col.prc
logical, if TRUE
, column percentage values are shown
show.exp
logical, if TRUE
, expected values are also shown
show.summary
If TRUE
(default), a summary row with total and valid N as well as mean and
standard deviation is shown.
show.legend
logical, if TRUE
, and depending on plot type and
function, a legend is added to the plot.
show.na
logical, if TRUE
, NA
's (missing values)
are added to the output. string.total
label for the total column / row header
digits
numeric, amount of digits after decimal point when rounding estimates and values.
tdcol.n
Color for highlighting count (observed) values in table cells. Default is black.
tdcol.expected
Color for highlighting expected values in table cells. Default is cyan.
tdcol.cell
Color for highlighting cell percentage values in table cells. Default is red.
tdcol.row
Color for highlighting row percentage values in table cells. Default is blue.
tdcol.col
Color for highlighting column percentage values in table cells. Default is green.
emph.total
logical, if TRUE
, the total column and row will be emphasized with a
different background color. See emph.color
.
emph.color
logical, if emph.total = TRUE
, this color value will be used
for painting the background of the total column and row. Default is a light grey.
prc.sign
The percentage sign that is printed in the table cells, in HTML-format.
Default is " %"
, hence the percentage sign has a non-breaking-space after
the percentage value.
hundret
Default value that indicates the 100-percent column-sums (since rounding values
may lead to non-exact results). Default is "100.0"
.
encoding
string, indicating the charset encoding used for variable and
value labels. Default is NULL
, so encoding will be auto-detected
depending on your platform (e.g., "UTF-8"
for Unix and "Windows-1252"
for
Windows OS). Change encoding if specific chars are not properly displayed (e.g. German umlauts).
file
destination file, if the output should be saved as file.
If NULL
(default), the output will be saved as temporary file and
openend either in the IDE's viewer pane or the default web browser.
use.viewer
If TRUE
, the HTML table is shown in the IDE's viewer pane. If
FALSE
or no viewer available, the HTML table is opened in a web browser.
no.output
logical, if TRUE
, the html-output is neither opened in a browser nor shown in
the viewer pane and not even saved to file. This option is useful when the html output
should be used in knitr
documents. The html output can be accessed via the return
value.
remove.spaces
logical, if TRUE
, leading spaces are removed from all lines in the final string
that contains the html-data. Use this, if you want to remove parantheses for html-tags. The html-source
may look less pretty, but it may help when exporting html-tables to office tools.