cormatrix: A Function to Create a Correlation Matrix

Description Usage Arguments Examples

Description

This function allows you to print the output of data frames and most R functions in an APA formatted table.

Usage

1
2
3
4
cormatrix(ivs = NULL, data = "NULL", method = "pearson",
  output = "r", means = FALSE, columnnames = TRUE, CI = FALSE,
  CIlevel = 0.95, displayDF = FALSE, displayP = FALSE,
  showSig = TRUE, digits = 3)

Arguments

ivs

List of variables from which to compute all pairwise correlations. Input must be a list (i.e., c("var1","var2")). Defaults to NULL.

data

A data frame containing the observed variables to correlate. Defaults to NULL.

method

Type of correlation coefficient to computed. Options include "pearson","kendall", or "spearman". Defaults to "pearson".

output

the format desired for output. Options include "html" or "r". Defaults to "r".

columnnames

Option to determine whether variable names are used as column headers (TRUE) or numbers are used instead (FALSE). Defaults to TRUE.

CI

Option to include confidence intervals in the correlation matrix table. Defaults to FALSE.

CIlevel

If confidence intervals are requested, this sets the desired confidence interval. Defaults to .95

displayDF

Option to include the degrees of freedom used in each test in the correlation matrix table. Defults to FALSE.

displayP

Option to include the statistical significance (p-value) of each correlation in the matrix. Null hypothesis that there is no relationship between the variables (r=0). Defaults to FALSE.

showSig

Option to include symbols beside correlation coefficient denoting the level of significance of each correlation. Levels include p < .1, p < .05, p < .1, p < .001. Defaults to FALSE.

digits

Number of digits you want to round numbers too. Leave blank if you don't want to round numbers or if the Data Frame contains strings. Defaults to NULL.

Examples

1
cormatrix(ivs = c("mpg","wt","hp"), data=mtcars, digits=3, output="html", columnnames = FALSE, CI=TRUE, CIlevel=.95, displayDF=TRUE, displayP=TRUE, showSig=TRUE)

matthew-quesnel/simplePsych documentation built on May 17, 2019, 12:02 p.m.