From Achim@Zeilei@ @ending from uibk@@c@@t  Thu Jun 28 00:58:49 2018
From: Achim@Zeilei@ @ending from uibk@@c@@t (Achim Zeileis)
Date: Thu, 28 Jun 2018 00:58:49 +0200 (CEST)
Subject: [Rd] new behavior in model.response
In-Reply-To: <bb6fa2$9mk1q0@ironport10.mayo.edu>
References: <bb6fa2$9mk1q0@ironport10.mayo.edu>
Message-ID: <alpine.DEB.2.21.1806280045420.28315@paninaro>

On Thu, 28 Jun 2018, Therneau, Terry M., Ph.D. via R-devel wrote:

> I now understand the issue, which leads to a different and deeper issue 
> which is "how to assign a proper length to Surv objects".
>
> > Surv(c(1,2,3), c(1,0,1))
> [1] 1? 2+ 3
>
> The above prints as 3 elements and is conceptually 3 elements. But if I 
> give it length method to return a 3 then I need a names method, and 
> names<-? pays no attention to my defined length. How do we conceive of 
> and manage a vector whose elements happen to require more than one 
> storage slot for their representation?? An obvious example is the 
> complex type, but it seems that had to be baked right down into the 
> core.

I think you just have to implement all methods required to make it look 
like a vector even if it is internally a matrix. Thus, you need methods 
for length and for names and names<-. Internally, the names can be stored 
as row names.

Further useful methods for "Surv" objects might include 
- as.double/as.integer (presumably just extracting the "time"),
- c
- str

Possibly also a dedicated summary.

An example for such a class is our "paircomp" in "psychotools". But I'm 
sure there are other/better examples elsewhere.

Best,
Achim


[Rd] new behavior in model.response
Achim Zeileis