r-lib / vctrs

Generic programming with typed R vectors
https://vctrs.r-lib.org
Other
290 stars 66 forks source link

`vec_detect_complete()` fails for `Surv()` objects #1953

Open EmilHvitfeldt opened 2 months ago

EmilHvitfeldt commented 2 months ago

As the title says, the vec_detect_complete() function fails via a stack overflow issue for Surv() object data. Most likely happening because Surv() objects are matrices

library(vctrs)
library(survival)

complete.cases(
  Surv(c(1, 5, 2), c(1, 0, 1))
)
#> [1] TRUE TRUE TRUE

vec_detect_complete(
  Surv(c(1, 5, 2), c(1, 0, 1))
)
DavisVaughan commented 2 months ago

I imagine this is https://github.com/r-lib/vctrs/issues/1370, due to kind of a crappy as.data.frame.Surv method that we are probably going to have to manually work around