tail() is broken for Surv objects, because despite Surv objects exposing
their implementation as matrices (probably a bad decision), they do not
inherit from class "matrix". One option is to make length.Surv return the
number of elements (rows in the matrix) instead of the number of cells, but
who knows how much code that would break. I filed an issue on their GitHub
project: https://github.com/therneau/survival/issues/22

Michael


On Sun, May 28, 2017 at 5:20 PM, Levi Waldron <lwaldron.resea...@gmail.com>
wrote:

> Running and updated Bioc 3.5:
>
> > library(survival)
> > set.seed(1)
> > cens <- sample(0:1, 100, replace=TRUE)
> > time <- rnorm(100)
> > df = DataFrame(time=time, cens=cens, y=Surv(time, cens))
> > df[1:3, ]  #OK
> DataFrame with 3 rows and 3 columns
>         time      cens               y.from
>    <numeric> <integer>               <Surv>
> 1  0.3981059         0  0.398105880367068:0
> 2 -0.6120264         0 -0.612026393250771:0
> 3  0.3411197         1  0.341119691424425:1
> > df #error
> DataFrame with 100 rows and 3 columns
> *Error in unclass(x)[i, , drop = FALSE] : subscript out of bounds*
> >
>
> This came up after I noticed something similar in
> MultiAssayExperiment::wideFormat() when trying to reshape a Surv column,
> but I'm not sure it's a bug in MultiAssayExperiment:
>
> > library(MultiAssayExperiment)
> > miniACC$y <- Surv(miniACC$days_to_death, miniACC$vital_status)
> > res = wideFormat(miniACC["EZH2", , ], colDataCols="y")
>  Show Traceback
>
>  Rerun with Debug
> * Error in unclass(x)[i, , drop = FALSE] : subscript out of bounds *
> >
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> Bioc-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>

        [[alternative HTML version deleted]]

_______________________________________________
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel

Reply via email to