0

I´m new in R and now I have this code

grap <- survfit(Surv(lab5$futime, lab5$fustat) ~1, data = lung)
ggsurvplot(grap, data = lung, xlab = "Days",
           ylab = "Overall survival probability")`

But I have this error:

Error in eval(inp, data, env) : objeto 'futime' no encontrado".

Ronak Shah
  • 377,200
  • 20
  • 156
  • 213
  • 1
    Without knowing what `lab5` (and `lung`) are, there's really nothing we can do. Please make this question *reproducible*. This includes sample code (including listing non-base R packages), sample *unambiguous* data (e.g., `dput(head(x))` or `data.frame(x=...,y=...)`), and expected output. Refs: https://stackoverflow.com/questions/5963269, https://stackoverflow.com/help/mcve, and https://stackoverflow.com/tags/r/info. – r2evans Jan 29 '20 at 04:59
  • ... and while I am not a pro with that package, I would expect the call to *not* have frame names (and dollar-indexing) in it, likely something more like `survfit(Surv(futime, fustat) ~ 1, data=lung)`, assuming that `futime` and `fustat` are columns in the `lung` frame. – r2evans Jan 29 '20 at 05:01
  • 1
    Well, `lung` is the included example data with the `survival` package. So that probably included in the example code. For your data, you'd probably want to use `survfit(Surv(futime, fustat) ~1, data = lab5)` and `ggsurvplot(grap, data = lab5)`. – Axeman Jan 29 '20 at 05:17
  • Voting to close as a typo. Axeman is probably correct. The error is thrown by a function call with a Surv-object using columns from one data set but with a `data` argument pointing to a different data object. The ggsurvplot call is unable to find the data items referenced – IRTFM Feb 03 '20 at 05:30

0 Answers0