1. A Surv object is a matrix with some extra attributes. The as.matrix.Surv function removes the extras but otherwise leaves it as is.

2. The last several versions of the survival library were accidentally missing the S3method('as.matrix', 'Surv') line from their NAMESPACE file. (Instead it's position is held by a duplicate of the line just above it in the NAMESPACE file, suggesting a copy/paste error). As a consequence the as.matrix.Surv function was effectively ignored, and the default method was being used.
   The as.matrix.default function leaves anything with a "dim" attribute alone.

3. In my current about-to-submit-to-CRAN version of survival the missing NAMESPACE line was restored. This breaks one function in one package (rms) which calls "as.matrix(y)" on a Surv object but then later looks at the "type" attribute of y.

So now to the design question: should the as.matrix.Surv function "sanitize" the result by removing the extra attributes, or should it leave them alone? The first seems cleaner; my accidental multi-year test of leaving them in, however, clearly shows that it does no harm.

Terry T.

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to