| sjt.corr {sjPlot} | R Documentation |
Shows the results of a computed correlation as HTML table. Requires either
a data.frame or a matrix with correlation coefficients
as returned by the cor-function.
sjt.corr(data, na.deletion = c("listwise", "pairwise"),
corr.method = c("pearson", "spearman", "kendall"), title = NULL,
var.labels = NULL, wrap.labels = 40, show.p = TRUE, p.numeric = FALSE,
fade.ns = TRUE, val.rm = NULL, digits = 3, triangle = "both",
string.diag = NULL, 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. |
na.deletion |
Indicates how missing values are treated. May be either
|
corr.method |
Indicates the correlation computation method. May be one of
|
title |
Table caption, as character vector. |
var.labels |
Character vector with variable names, which will be used to label variables 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.p |
Logical, adds significance levels to values, or value and variable labels. |
p.numeric |
Logical, if |
fade.ns |
Logical, if |
val.rm |
Specify a number between 0 and 1 to suppress the output of correlation values
that are smaller than |
digits |
Numeric, amount of digits after decimal point when rounding estimates and values. |
triangle |
Indicates whether only the upper right (use |
string.diag |
A vector with string values of the same length as |
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 |
See 'Details' in sjt.frq.
Invisibly returns
the web page style sheet (page.style),
the web page content (page.content),
the complete html-output (page.complete) and
the html-table with inline-css for use with knitr (knitr)
for further use.
If data is a matrix with correlation coefficients as returned by
the cor-function, p-values can't be computed.
Thus, show.p, p.numeric and fade.ns
only have an effect if data is a data.frame.
Additionally, see 'Note' in sjt.frq.
## Not run:
# plot correlation matrix using circles
sjt.corr(mydf)
# Data from the EUROFAMCARE sample dataset
library(sjmisc)
data(efc)
# retrieve variable and value labels
varlabs <- get_label(efc)
# recveive first item of COPE-index scale
start <- which(colnames(efc) == "c83cop2")
# recveive last item of COPE-index scale
end <- which(colnames(efc) == "c88cop7")
# create data frame with COPE-index scale
mydf <- data.frame(efc[, c(start:end)])
colnames(mydf) <- varlabs[c(start:end)]
# we have high correlations here, because all items
# belong to one factor. See example from "sjp.pca".
sjt.corr(mydf, p.numeric = TRUE)
# auto-detection of labels, only lower triangle
sjt.corr(efc[, c(start:end)], triangle = "lower")
# auto-detection of labels, only lower triangle, all correlation
# values smaller than 0.3 are not shown in the table
sjt.corr(efc[, c(start:end)], triangle = "lower", val.rm = 0.3)
# auto-detection of labels, only lower triangle, all correlation
# values smaller than 0.3 are printed in blue
sjt.corr(efc[, c(start:end)], triangle = "lower",val.rm = 0.3,
CSS = list(css.valueremove = 'color:blue;'))
## End(Not run)