Learn R Programming

textir (version 1.8-8)

corr: Sparse Matrix Correlation

Description

Correlation calculation for a simple_triplet_matrix and a matrix.

Usage

corr(x, y)

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.

See Also

cor, sdev, freq, congress109

Examples

Run this code
data(congress109)
r <- corr(congress109Counts, congress109Ideology$repshare)
## 20 terms for Democrats
sort(r[,1])[1:20]
## 20 terms for Republicans
sort(r[,1], decreasing=TRUE)[1:20]

Run the code above in your browser using DataLab