Learn R Programming

gamlr (version 0.1)

corr: Sparse Matrix Correlation

Description

Correlation calculations for a simple_triplet_matrix and a matrix.

Usage

corr(x, y)
sdev(x)

Arguments

x
A simple_triplet_matrix (or a matrix, in which case the function returns cor(x,y)).
y
A matrix with nrow(y)=nrow(x).

Value

  • An ncol(x) by ncol(y) matrix containing correlation between x and y, or just the vector of column standard deviations for sdev.

Examples

Run this code
data(hockey)

## some good players
r <- corr(Xplayer, Ygoals)
sort(r[,1], decreasing=TRUE)[1:20]

## players with lots of ice-time
s <- sdev(Xplayer)
sort(s, decreasing=TRUE)[1:20]

Run the code above in your browser using DataLab