Covariance-to-correlation methods for amatrix objects
Source:R/methods-cov2cor.R
cov2cor-methods.RdBridge cov2cor() through Matrix's covariance-to-correlation methods
so standard workflows such as cov2cor(crossprod(X)) keep working
when crossprod() preserves an amatrix class.
Value
A base R correlation matrix, matching stats::cov2cor() on
the corresponding host matrix.
Examples
X <- adgeMatrix(matrix(1:9 + 0, 3, 3))
cov2cor(crossprod(X))
#> [,1] [,2] [,3]
#> [1,] 1.0000000 0.9746318 0.9594119
#> [2,] 0.9746318 1.0000000 0.9981909
#> [3,] 0.9594119 0.9981909 1.0000000