| sjt.frq {sjPlot} | R Documentation |
Shows (multiple) frequency tables as HTML file, or saves them as file.
sjt.frq(data, weight.by = NULL, title.wtd.suffix = " (weighted)",
title = NULL, value.labels = NULL, sort.frq = c("none", "asc", "desc"),
altr.row.col = FALSE, string.val = "value", string.cnt = "N",
string.prc = "raw %", string.vprc = "valid %",
string.cprc = "cumulative %", string.na = "missings", emph.md = FALSE,
emph.quart = FALSE, show.summary = TRUE, show.skew = FALSE,
show.kurtosis = FALSE, skip.zero = "auto", ignore.strings = TRUE,
auto.group = NULL, auto.grp.strings = TRUE, max.string.dist = 3,
digits = 2, CSS = NULL, encoding = NULL, file = NULL,
use.viewer = TRUE, no.output = FALSE, remove.spaces = TRUE)
data |
A vector or a data frame, for which frequencies should be printed as table. |
weight.by |
Vector of weights that will be applied to weight all cases.
Must be a vector of same length as the input vector. Default is
|
title.wtd.suffix |
Suffix (as string) for the title, if |
title |
Table caption, as character vector. |
value.labels |
Character vector (or |
sort.frq |
Determines whether categories should be sorted
according to their frequencies or not. Default is |
altr.row.col |
Logical, if |
string.val |
Character label for the very first table column containing the values (see
|
string.cnt |
Character label for the first table data column containing the counts. Default is |
string.prc |
Character label for the second table data column containing the raw percentages. Default is |
string.vprc |
Character label for the third data table column containing the valid percentages, i.e. the count percentage value exluding possible missing values. |
string.cprc |
Character label for the last table data column containing the cumulative percentages. |
string.na |
Character label for the last table data row containing missing values. |
emph.md |
Logical, if |
emph.quart |
Logical, if |
show.summary |
Logical, if |
show.skew |
Logical, if |
show.kurtosis |
Logical, if |
skip.zero |
Logical, if |
ignore.strings |
Logical, if |
auto.group |
numeric value, indicating the minimum amount of unique values
in the count variable, at which automatic grouping into smaller units
is done (see |
auto.grp.strings |
Logical, if |
max.string.dist |
Numeric, the allowed distance of string values in a character vector, which indicates
when two string values are merged because they are considered as close enough.
See |
digits |
Numeric, amount of digits after decimal point when rounding estimates and values. |
CSS |
A |
encoding |
String, indicating the charset encoding used for variable and
value labels. Default is |
file |
Destination file, if the output should be saved as file.
If |
use.viewer |
Logical, if |
no.output |
Logical, if |
remove.spaces |
Logical, if |
Invisibly returns
the web page style sheet (page.style),
each frequency table as web page content (page.content.list),
the complete html-output (page.complete) and
the html-table with inline-css for use with knitr (knitr)
for further use.
## Not run:
# load sample data
library(sjmisc)
data(efc)
# show frequencies of "e42dep" in RStudio Viewer Pane
# or default web browser
sjt.frq(efc$e42dep)
# plot and show frequency table of "e42dep" with labels
sjt.frq(efc$e42dep, title = "Dependency",
value.labels = c("independent", "slightly dependent",
"moderately dependent", "severely dependent"))
# plot frequencies of e42dep, e16sex and c172code in one HTML file
# and show table in RStudio Viewer Pane or default web browser
# Note that value.labels of multiple variables have to be
# list-objects
sjt.frq(data.frame(efc$e42dep, efc$e16sex, efc$c172code),
title = c("Dependency", "Gender", "Education"),
value.labels = list(c("independent", "slightly dependent",
"moderately dependent", "severely dependent"),
c("male", "female"), c("low", "mid", "high")))
# auto-detection of labels
sjt.frq(data.frame(efc$e42dep, efc$e16sex, efc$c172code))
# plot larger scale including zero-counts
# indicating median and quartiles
sjt.frq(efc$neg_c_7, emph.md = TRUE, emph.quart = TRUE)
# sort frequencies
sjt.frq(efc$e42dep, sort.frq = "desc")
# User defined style sheet
sjt.frq(efc$e42dep,
CSS = list(css.table = "border: 2px solid;",
css.tdata = "border: 1px solid;",
css.firsttablecol = "color:#003399; font-weight:bold;"))
## End(Not run)