cor.table {petersenlab} | R Documentation |
Correlation Matrix.
Description
Function that creates a correlation matrix similar to SPSS output.
Usage
cor.table(x, y, type = "none", dig = 2, correlation = "pearson")
Arguments
x |
Variable or set of variables in the form of a vector or dataframe
to correlate with |
y |
(optional) Variable or set of variables in the form of a vector or
dataframe to correlate with |
type |
Type of correlation matrix to print. One of:
|
dig |
Number of decimals to print. |
correlation |
Method for calculating the association. One of:
|
Details
Co-created by Angela Staples (astaples@emich.edu) and Isaac Petersen (isaac-t-petersen@uiowa.edu). For a partial correlation matrix, see partialcor.table.
Value
A correlation matrix.
See Also
Other correlations:
addText()
,
crossTimeCorrelation()
,
crossTimeCorrelationDF()
,
partialcor.table()
,
vwReg()
Examples
# Prepare Data
data("mtcars")
# Correlation Matrix
cor.table(mtcars[,c("mpg","cyl","disp")])
cor.table(mtcars[,c("mpg","cyl","disp")])
cor.table(mtcars[,c("mpg","cyl","disp")], dig = 3)
cor.table(mtcars[,c("mpg","cyl","disp")], dig = 3, correlation = "spearman")
cor.table(mtcars[,c("mpg","cyl","disp")], type = "manuscript", dig = 3)
cor.table(mtcars[,c("mpg","cyl","disp")], type = "manuscriptBig")
table1 <- cor.table(mtcars[,c("mpg","cyl","disp")], type = "latex")
table2 <- cor.table(mtcars[,c("mpg","cyl","disp")], type = "latexSPSS")
table3 <- cor.table(mtcars[,c("mpg","cyl","disp")], type = "manuscriptLatex")
table4 <- cor.table(mtcars[,c("mpg","cyl","disp")], type = "manuscriptBigLatex")
cor.table(mtcars[,c("mpg","cyl","disp")], mtcars[,c("drat","qsec")])
cor.table(mtcars[,c("mpg","cyl","disp")], mtcars[,c("drat","qsec")], type = "manuscript", dig = 3)