title: Using ggsurv function in R version 3.1.0
body: <p>I am trying to create a survival plot in R for deaths from exposure to a fungal disease over a number of weeks. I have the death week(continuous), whether they were alive (TRUE/FALSE), as well as categorical variables for diet (high/low) and sex(male/female). I have run a coxph model: </p>
  
  <pre><code>surv1 &lt;- coxph(Surv(week_died,alive) ~ exposed + diet + sex,
          data=surv)
  </code></pre>
  
  <p>I would like to plot a survival curve, with individual lines for exposed males on high and low diets, and the same for females on high and low diets (resulting in 4 individual survival curves on the same plot). if I use this then I only get a single curve. </p>
  
  <pre><code>plot(survfit(surv1), ylim=c(), xlab="Weeks") 
  </code></pre>
  
  <p>I have also tried to use the ggsurv function created by Edwin Thoen (<a href="http://www.r-statistics.com/2013/07/creating-good-looking-survival-curves-the-ggsurv-function/" rel="nofollow">http://www.r-statistics.com/2013/07/creating-good-looking-survival-curves-the-ggsurv-function/</a>) but keep getting an error for "invalid line type". I have tried to work out what could be causing this and think it would be this last ifelse statement - but I am not sure.    </p>
  
  <pre><code>pl &lt;- if(strata == 1) {ggsurv.s(s, CI , plot.cens, surv.col ,
                                cens.col, lty.est, lty.ci,
                                cens.shape, back.white, xlab,
                                ylab, main)
  } else {ggsurv.m(s, CI, plot.cens, surv.col ,
                 cens.col, lty.est, lty.ci,
                 cens.shape, back.white, xlab,
                 ylab, main)}
  </code></pre>
  
  <p>Does anyone have any idea on what is causing this error/how to fix it or if I completely trying to do the wrong thing to plot these curves. </p>
  
  <p>Many thanks! </p>