> Hmm, really? In `R Under development (unstable) (2020-08-14
> r79020)`, doing the indexed assignment with a regular matrix (as opposed
> to a Matrix) appears to preserve attributes.
I was referring to *Matrix* objects.
Sorry, if that wasn't clear.
__
Thanks for taking a look!
Hmm, really? In `R Under development (unstable) (2020-08-14
r79020)`, doing the indexed assignment with a regular matrix (as opposed
to a Matrix) appears to preserve attributes.
m1 <- matrix(1:9,3,3)
attr(m1,"junk") <- 12
stopifnot(isTRUE(attr(m1,"junk")==12))
Hi Ben,
I had some problems reproducing this.
As far as I can tell *all* indexed assignments drop attributes.
(Maybe we have different versions).
I'm not an expert on S4, but I'm unenthusiastic about mixing slot (S4)
semantics with attribute (S3) semantics.
And str() excludes attributes, but attr
Does this constitute a bug, or is there something I'm missing?
assigning sub-elements of a sparse Matrix via M[X]<-..., where X is a
2-column matrix, appears to drop user-assigned attributes. I dug around
in the R code for Matrix trying to find the relevant machinery but my
brain started to h