Hi Hervé,
> Is it? One could argue that a more sensible behavior would be that
> things like `[`(..., drop=FALSE), rbind(), cbind(), etc... preserve
> the class attribute.
>
> Interestingly t() does that
>
> So if it makes sense for t() and reshaping, it's not clear why it
> wouldn't for [, aper
On 7/7/19 17:41, Jialin Ma wrote:
> Hi Abby,
>
> Thanks a lot for your paraphrasing and your suggestion!
>
> The problem of wrapping the list into a S3/S4 object, i.e. subclassing array
> or matrix, is that one also has to define a bunch of methods for subsetting,
> joining, etc, in order to make
> This works fine but no longer work after we do some simple operations.
> myArray[1:2, 1:2, 2]
> # [,1] [,2]
> # [1,] ??
> # [2,] ??
OK, that's a good point.
I didn't think of that.
Michael Lawrence was probably correct in his comment:
>However, as soon as you start
> treat
Hi Michael,
Thanks for your reply. I suppose using a new S3/S4 class wrapping the list
could solve my problem, but again I think it brings too much cost for
maintaining the expected behavior. I was aware that Rmpfr package takes this
approach and uses a similar structure (a S4 class wrapping a li
Hi Abby,
> > It is not desirable if a
> > simple matrix subsetting will remove the class attributes of the object.
>
> I'm assuming by "the object" you are referring to the matrix.
> And by "class attribute"-"s" you are referring to all the attributes.
> This is a completely separate discussion fr
A generic for displaying an object in a cell would be a reasonable
solution for this particular problem. However, as soon as you start
treating these objects as data (like putting them into a matrix),
you're likely going to want vectorized operations over them, which
means formalized vector and mat
> The problem of wrapping the list into a S3/S4 object, i.e. subclassing
array
> or matrix, is that one also has to define a bunch of methods for
subsetting,
> joining, etc, in order to make it behave like a list array.
False, sorry.
Wrapping != Defining a New Class.
And you don't have to define a
Hi Abby,
Thanks a lot for your paraphrasing and your suggestion!
The problem of wrapping the list into a S3/S4 object, i.e. subclassing array
or matrix, is that one also has to define a bunch of methods for subsetting,
joining, etc, in order to make it behave like a list array. The reason is that
> I am not sure if there is an existing solution to this, but I want my S4
> objects inside a list matrix showing correctly.
> R> matrix(lst, 2)
> [,1] [,2] [,3] [,4] [,5]
> [1,] ?????
> [2,] ?????
> Is it possible that the print method for matrix can call some