title: R :Fitting survival trees with time-varying covariates in RandomForestSRC
body: <p>In the package LTRCtrees one can fit a decision tree to the special format of the Surv function :Surv(time, time2, event) as per below example </p>
  
  <pre><code>set.seed(0)
  library(survival)
  library(LTRCtrees)
  ## Create the start-stop-event triplet needed for coxph and LTRC trees
  first &lt;- with(pbcseq, c(TRUE, diff(id) !=0)) #first id for each subject
  last &lt;- c(first[-1], TRUE) #last id
  time1 &lt;- with(pbcseq, ifelse(first, 0, day))
  time2 &lt;- with(pbcseq, ifelse(last, futime, c(day[-1], 0)))
  event &lt;- with(pbcseq, ifelse(last, status, 0))
  event &lt;- 1*(event==2)
  
  pbcseq$time1 &lt;- time1
  pbcseq$time2 &lt;- time2
  pbcseq$event &lt;-  event
  
  ## Fit the Cox model and LTRC trees with time-varying covariates
  fit.cox &lt;- coxph(Surv(time1, time2, event) ~ age + sex + log(bili), pbcseq)
  LTRCIT.fit &lt;- LTRCIT(Surv(time1, time2, event) ~ age + sex + log(bili), pbcseq)
  LTRCART.fit &lt;- LTRCART(Surv(time1, time2, event) ~ age + sex + log(bili), pbcseq)
  </code></pre>
  
  <p>Is it possible to use the same function on a Random Forest using the RandomForestSRC library</p>
  
  <pre><code>library(randomForestSRC)
  RF.fit &lt;- rfsrc(Surv(time1, time2, event) ~ age + sex + log(bili), data=pbcseq, nsplit = 3, ntree = 100, importance = TRUE)
  </code></pre>
  
  <p>Which generates an error:</p>
  
  <pre><code>Error in parseFormula(formula, data, ytry) : 
    Survival formula incorrectly specified.
  </code></pre>