correlate: Correlation Data Frame

Description Usage Arguments Details Value Examples

View source: R/correlate.R

Description

An implementation of stats::cor(), which returns a correlation matrix in a specific format. See details below. Additional adjustment include the use of pairwise deletion by default.

Usage

1
correlate(x, y = NULL, use = "pairwise.complete.obs", method = "pearson")

Arguments

x

a numeric vector, matrix or data frame.

y

NULL (default) or a vector, matrix or data frame with compatible dimensions to x. The default is equivalent to y = x (but more efficient).

use

an optional character string giving a method for computing covariances in the presence of missing values. This must be (an abbreviation of) one of the strings "everything", "all.obs", "complete.obs", "na.or.complete", or "pairwise.complete.obs".

method

a character string indicating which correlation coefficient (or covariance) is to be computed. One of "pearson" (default), "kendall", or "spearman": can be abbreviated.

Details

This function returns a correlation matrix in the following format:

The main feature is the use of the data frame. This is to make use of data frame manipulation packages like dplyr and tidyr.

Value

A correlation data frame (cor_df)

Examples

1
2
3
4
5
6
7
## Not run: 
correlate(iris)

## End(Not run)

correlate(mtcars)
correlate(iris[-5])

corrr documentation built on May 29, 2017, 3:44 p.m.

Search within the corrr package
Search all R packages, documentation and source code