[Bioc-devel] DataFrame errors with a Surv class column
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 *