jmvtab | R Documentation |
Crosstables
jmvtab(
data,
row_vars = NULL,
col_vars = NULL,
tab_vars = NULL,
wt = NULL,
pct = "no",
color = "no",
chi2 = TRUE,
OR = "no",
na = "keep",
lvs = "all",
other_if_less_than = 0,
cleannames = TRUE,
ref = "auto",
ref2 = "first",
comp = "tab",
ci = "auto",
conf_level = 0.95,
ci_print = "ci",
totaltab = "line",
wrap_rows = 35,
wrap_cols = 15,
display = "auto",
add_n = TRUE,
add_pct = FALSE,
subtext = "",
digits = 0
)
data |
A data.frame. |
row_vars |
The row variable, which will be printed with one level per line. If numeric, it will be converted to factor. |
col_vars |
One column is printed for each level of each column variable. For numeric variables means are calculated, in a single column. |
tab_vars |
One subtable is made for each combination of levels of the tab variables. All tab variables are converted to factor. Leave empty to make a simple table. |
wt |
A weight variable, of class numeric. Leave empty for unweighted results. |
pct |
The type of percentages to calculate :
|
color |
The type of colors to print, as a single string. Vectorised
over
|
chi2 |
Set to |
OR |
With
|
na |
The policy to adopt with missing values. It must be a single string.
|
lvs |
The levels of
|
other_if_less_than |
When set to a positive integer, levels with less count than that will be merged into an "Others" level. |
cleannames |
By default, clean levels names, by removing prefix
numbers like "1-", and text in parenthesis. Set to |
ref |
The reference cell to calculate differences and ratios (used
to print
|
ref2 |
A second reference cell is needed to calculate odds ratios (or
relative risks ratios). The first cell of the row or column is used by
default. See |
comp |
The comparison level : by subtables/groups, or for the whole table. |
ci |
The type of confidence intervals to calculate, passed to
By default,
for percentages, with |
conf_level |
The confidence level, as a single numeric between 0 and
|
ci_print |
By default confidence interval are printed with the interval display. Set to "moe" to use pct +- moe instead. |
totaltab |
The total table, if there are subtables/groups (i.e. when
|
wrap_rows |
By default, rownames are wrapped when larger than 30 characters. |
wrap_cols |
By default, colnames are wrapped when larger than 12 characters. |
display |
The information to display in the table. |
add_n |
For |
add_pct |
Set to |
subtext |
A character vector to print rows of legend under the table. |
digits |
The number of digits to print, as a single integer, or an
integer vector the same length as |
A results object containing:
results$html_table | a html | ||||
results$chi2_table | a table | ||||
results$plot | an image | ||||
Tables can be converted to data frames with asDF
or as.data.frame
. For example:
results$chi2_table$asDF
as.data.frame(results$chi2_table)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.