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

[known defect with package dependency on survival package] [update when R dependency over 4.4.0] #1366

Open
shajoezhu opened this issue Dec 23, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@shajoezhu
Copy link
Contributor

          this will be closed by https://github.com/insightsengineering/tern/pull/1365

However, this issue needs to be revisited when we can upversion to R (≥ 4.4.0), given Matrix dependency https://cran.r-project.org/web/packages/Matrix/index.html, which is required by the survival package 3.8-3, https://cran.r-project.org/web/packages/survival/index.html

breaking change was flagged by survival package author

I am running a large number of checks on packages that depend on survival.  The rationale for the changes is given below.  For these  6 packages it was noted that they make use of the phrase  survival::strata() inside a formula, which doesn't do what people think it does: ggRandomForests, insight, mfp2, rineq, simtrial, and tern.   You might want to take a further look at your tests.   The new version 3.6-2 is on github and should be on CRAN shortly.

Terry Therneau

The latest version of the survival package has an important addition.  In prior code the call
     coxph(Surv(time, status) ~ age + strata(inst), data=lung)
 could fail if a version of either Surv() or strata() existed elsewhere on the search path; the wrong function could be picked up.  This has now been rectified.  
 
 1. For the coxph, concordance, survcheck, survfit, and survdiff modeling functions, any Surv(), strata(), cluster(), psline() or tt() model terms will use the versions from the survival namespace, automatically.
 
 2. Any use of survival::Surv(), survival::strata(), survival::cluster(), survival::pspline() or survival::tt() will have the 'survival::' modifier removed before the formula is evaluated.
 
 3. An exception to 1 above are models with a function/variable conflict such as Surv(time, status) ~ x + strata + strata(group) (found in the Epi package) or Surv(time, status) ~ x + strata(strata) (found in epiDisplay); I simply haven't thought of an automatic way to pick strata() from survival and the strata variable locally without stepping on my own feet.  In that same formula Surv() will be correctly dealt with, however.
 
 4. The call component of the relevant coxph, survfit, etc result is not changed, it still documents what you actually typed.  (Updating it  breaks a half dozen of the 800+ CRAN packages which make use of survival).
 
 This has no bearing on any discussion of whether to use coxph or survival::coxph as the primary call.  
 
One motivation for this is that use of :: messes up formula processing, in particular the "specials" argument of model.frame, something the survival package depends on.  For instance, in versions prior to survival3.8-0 the following two calls lead to completely different models; in the second strata is not recognized as special.
     coxph(Surv(time, status) ~ age + strata(inst), data=lung)
     coxph(Surv(time, status) ~ age + survival::strata(inst), data = lung)
Under the new regime both now work properly. 

Originally posted by @shajoezhu in #1364 (comment)

@shajoezhu shajoezhu added the bug Something isn't working label Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant