Date: 2022-10-24 15:47 Sender: Martin MaechlerThank you, Ben.
Note that for previous (incl current) versions of {Matrix},
your last function call gives for me (several versions of R with respective versions of Matrix via library(Matrix, .Library) :
> dimnames(cov2cor(M2))
Error in asMethod(object) :
matrix is not symmetric; consider forceSymmetric() or symmpart()
Also note that your first call did (in several earlier versions) return *symmetrized* dimnames so was *also* not base R - compatible {which does not have formal symmetric matrices} but rather returned
> cov2cor(M) # a b c for *both* dimensions
3 x 3 Matrix of class "dpoMatrix"
a b c
a 1 0 0
b 0 1 0
c 0 0 1
>
---------------
Still the 1.5-2 behavior *is* a regression because when the matrix m has symmetric dimnames, they should definitely be kept .. and they are not.
I'm testing a fix (for Matrix 1.5-3 which will have to wait a bit ..).
|