How to put variable name with backtick in the function survfit

83 Views Asked by At

I changed the name of my variable so that the actual name of the variable is displayed in the graph instead of a name separated by an underscore.

pts_raw_reg<-pts_raw_reg%>%rename(
  "Surgery type"=baria_t
)

fit<-survfit(Surv(duree_suivi,Cancer)~`Surgery type`, data=pts_raw_reg)

But the function survfit does not take into account my variable name inside the backticks.

I have this error message:

Error in `[.data.frame`(mf, ll) : colonnes non définies sélectionnées



ggsurv<-ggsurvplot(fit, conf.int = TRUE, 
           palette = c("#FF9E29", "#86AA00"),
           risk.table = TRUE, risk.table.col = "strata",
           fun = "cumhaz", yli=c(0,0.05)
)
0

There are 0 best solutions below