An error in establish dynamical nomogram using “DynNom“” package


when i use the “DynNom“” package which is attached in "shiny" to establish dynamical nomogram with function coxph() in "survival" package, an error is reported in Rstudio, just as follow:
#my code :

> osf1 <- coxph(formula= Surv(time, os==1) ~ Age + Marital  + Metastasis + Surgery + Radiatherapy   + Lymphnodes_status + Size + Chemotherapy + Hispanic  + Lymphnodes_Examined ,data= ess1)
> DynNom(osf1,ess1)
# and the error is :
Listening on http://127.0.0.1:3191
Warning: Error in <-: replacement has length zero
  49: server
Error in i.numeric[dim(i.numeric)[1], 3] <- which(names(data) == i.numeric[dim(i.numeric)[1],  : 
  replacement has length zero
# in the formula, besides Age is numeric variable, all of others are factor variables
Strangely, when i use the function cph() to do cox regression  meodel, the code is run successfully, the code is as follow:
> osf1 <- cph(formula= Surv(time, os==1) ~ Age+ Marital  + Metastasis + Surgery +  Radiatherapy + Lymphnodes_status + Size + Chemotherapy + Hispanic  + Lymphnodes_Examined, x=T,y=T,surv= T,data = ess1) 
> DynNom(osf1,ess1)

my question is: what the errorr means and what can i do to solve this problem, i'd appreciated very much if you can give your hand to me. Thanks!!!

I recommend trying not to use "os==1" when fitting your model. Rerun your model as following and let me know if it fixed the issue:

osf1 <- coxph(formula = Surv(time, os) ~ Age + Marital + Metastasis + Surgery + Radiatherapy + Lymphnodes_status + Size + Chemotherapy + Hispanic + Lymphnodes_Examined ,data= ess1)
DynNom(osf1,ess1)

Thanks for your suggestion!! I've followed your suggestion to change my code, and the issue is fixed successfully!Thanks for your help again~

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.