Description Usage Arguments Value Author(s) See Also Examples
Correlation and deviation in sparse matrices.
1 2 |
x |
A |
y |
A |
corr
returns the ncol(x)
by ncol(y)
matrix of correlation between x and y, and sdev
returns the column standard deviations.
Matt Taddy taddy@chicagobooth.edu
pls, congress109
1 2 3 4 5 6 7 8 9 10 11 12 | # some congress examples
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]
## 20 high variance terms
colnames(congress109Counts)[
order(-sdev(congress109Counts))[1:20]]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.