Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201867

Object '.' not found while piping with dplyr

$
0
0

I am trying to conduct a survival curve using the survival package. The MWE code is as follows:

df %>% 
  filter(fac <= "Limit") %>% 
  survfit(Surv(tte, !is.na(event)) ~ fac, data = .) %>% 
  ggsurvplot(fit = .)

I get the error Error in eval(fit$call$data) : object '.' not found

When I try to break this down further by:

 survfit <- df %>% 
  filter(fac <= "Limit") %>% 
  survfit(Surv(tte, !is.na(event)) ~ fac, data = .)

 ggsurvplot(fit = survfit)

I get an identical error. Is anyone able to figure out how to pipe from my dataframe all the way through a survival curve? The reason I would like to do this is to streamline the filtering of my dataframe in order to produce a multitude of different survival curves without having to create many subsetted dataframes.


Viewing all articles
Browse latest Browse all 201867

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>