Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

survFit() fails for single row in newdata #117

Open
hfrick opened this issue May 11, 2022 · 0 comments · May be fixed by #118
Open

survFit() fails for single row in newdata #117

hfrick opened this issue May 11, 2022 · 0 comments · May be fixed by #118

Comments

@hfrick
Copy link

hfrick commented May 11, 2022

Getting a survival curve via survFit() for just one observation in newdata fails. I think it's just a matter of not dropping from a 1-column matrix to a vector in the expression before that. I'll send a PR 🙌

library(mboost)
#> Loading required package: parallel
#> Loading required package: stabs
library(survival)

mod <- blackboost(Surv(time, status) ~ age + ph.ecog, 
                  data = lung, 
                  family = CoxPH())
survFit(mod, lung[1,])
#> Error in `colnames<-`(`*tmp*`, value = rownames(newdata)): attempt to set 'colnames' on an object with less than two dimensions

Created on 2022-05-11 by the reprex package (v2.0.1)

@hfrick hfrick linked a pull request May 11, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant