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

Error occurs when applying stratification on Cox models #4

Closed
arazraw opened this issue Dec 9, 2015 · 1 comment
Closed

Error occurs when applying stratification on Cox models #4

arazraw opened this issue Dec 9, 2015 · 1 comment

Comments

@arazraw
Copy link

arazraw commented Dec 9, 2015

It is very common to apply stratification on Cox models. In the survival package, the "strata" argument is available in the "coxph" function. However, since the update of the package to CRAN, it returns an error when attempting to plot coxph objects which have utilized the strata function.

Example:

library(survival)
library(forestmodel)
data(lung)
fit <- coxph(Surv(time, status)~ age + strata(sex), data=lung)
forest_model(fit)
Error: could not find function "strata"

Any suggestions how to solve this?

Best regards

@NikNakk NikNakk closed this as completed in e3a1173 Dec 9, 2015
@NikNakk
Copy link
Owner

NikNakk commented Dec 9, 2015

This related to the use of non-standard evaluation by dplyr and the fact the the term name strata(sex) was interpreted as a call to a function strata on the variable sex. I've added in a as.name to fix this and have tidied the surrounding code a little. I've also changed it so that terms like strata which don't have a result in the final model get filtered out.

NikNakk pushed a commit that referenced this issue Sep 6, 2021
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

No branches or pull requests

2 participants