Re: [Rd] Format printing inside a matrix

2019-07-07 Thread Jialin Ma
make it a lot easier extending the behaviors of base list, matrix and array. Best regards, Jialin On Sunday, July 7, 2019 9:32:29 PM PDT Pages, Herve wrote: > On 7/7/19 17:41, Jialin Ma wrote: > > > Hi Abby, > > > > Thanks a lot for your paraphrasing and your suggestion! > >

Re: [Rd] Format printing inside a matrix

2019-07-07 Thread Jialin Ma
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

Re: [Rd] Format printing inside a matrix

2019-07-07 Thread Jialin Ma
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

Re: [Rd] Format printing inside a matrix

2019-07-07 Thread Jialin Ma
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

[Rd] Format printing inside a matrix

2019-07-01 Thread Jialin Ma
,1] [,2] [,3] [,4] [,5] [1,] ????? [2,] ????? Is it possible that the print method for matrix can call some type of generic such as `as.character` or `format` when it encounters such cases? Or is there any other place that I can override without introducing a new S3

[Rd] as.pairlist does not convert call objects

2018-03-27 Thread Jialin Ma
Dear all, It seems that as.pairlist does not convert call objects, producing results like the following: > is.pairlist(as.pairlist(quote(x + y))) [1] FALSE Should this behavior be expected? Thanks, Jialin > sessionInfo() R version 3.4.1 (2017-06-30) Platform: x86_64-suse-linux-gnu (64-bit) Ru

Re: [Rd] `@<-` modify its argument when slot is externalptr

2018-03-18 Thread Jialin Ma
`@<-`(x, .Data, 42) # An object of class "foo" # [1] 42 x # An object of class "foo" # [1] 2 y # An object of class "foo" # [1] 2 Best regards, Jialin On Sun, 2018-03-18 at 09:54 -0500, luke-tier...@uiowa.edu wrote: > On Sun, 18 Mar 2018, Jialin Ma wrote: >

[Rd] `@<-` modify its argument when slot is externalptr

2018-03-18 Thread Jialin Ma
Dear all, I am confused about the inconsistent behaviors of `@<-` operator when used in different ways. Consider the following example: library(inline) # Function to generate an externalptr object with random address new_extptr <- cfunction(c(), ' SEXP val = PROTECT(ScalarLogical(1))