calc.maxcor: Calculate maximum correlation

View source: R/calc_maxcor.R

calc.maxcorR Documentation

Calculate maximum correlation

Description

Calculates the maximum absolute correlation between two matrices along the columns

Usage

calc.maxcor(x1, x2)

Arguments

x1

Named matrix 1

x2

Named matrix 2

Details

This function calculates the maximum absolute correlation for each column of x2 against each column of x1. The matrices are named and if the names overlap between x1 and x2, the correlation between the same named entries is set to zero.

Value

A vector of maximum absolute correlations

Examples

x1 <- matrix(rnorm(500), 100, 5)
x2 <- x1 + matrix(rnorm(500), 100, 5)
colnames(x1) <- c("A", "B", "C", "D", "E")
colnames(x2) <- c("A", "B", "C", "D", "E")
cor(x1, x2)
calc.maxcor(x1, x2)


mohuangx/SAVER documentation built on June 16, 2022, 2:42 p.m.