Skip to content
Prev 58882 / 63424 Next

M[cbind()] <- assignment with Matrix object loses attributes

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 attributes() includes slots.
Highlighting the problems here...

I think R should generate an error or a warning, if a user tries to
assign attributes to S4 objects.

In saying that, mixing OO design with numerical linear algebra is a gold mine...
On Tue, Aug 11, 2020 at 1:23 PM Ben Bolker <bbolker at gmail.com> wrote: