corr {partition}R Documentation

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)

Arguments

x

a matrix or vector

y

a vector. Optional.

spearman

Logical. Use Spearman's correlation?

Value

a numeric vector, the correlation coefficient

Examples

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)


[Package partition version 0.2.1 Index]