partition (version 0.2.0)

corr: Efficiently fit correlation coefficient for matrix or two vectors

Description

Efficiently fit correlation coefficient for matrix or two vectors

Usage

corr(x, y = NULL, spearman = FALSE)

Value

a numeric vector, the correlation coefficient

Arguments

x

a matrix or vector

y

a vector. Optional.

spearman

Logical. Use Spearman's correlation?

Examples

Run this code
library(dplyr)
# fit for entire data set
iris %>%
  select_if(is.numeric) %>%
  corr()

# just fit for two vectors
corr(iris$Sepal.Length, iris$Sepal.Width)

Run the code above in your browser using DataLab