title: Trying to do cross-validation of a survival tree
body: <p>I'm trying to do survival analysis using decision trees in rpart, similar to here: <a href="https://stackoverflow.com/questions/30700627/using-a-survival-tree-from-the-rpart-package-in-r-to-predict-new-observations">Using a survival tree from the &#39;rpart&#39; package in R to predict new observations</a> . To compare the decision tree survival model to other models, such as Cox regression, I'd like to use cross-validation to get Dxy and compare the c-index. When I try to use <a href="http://www.inside-r.org/packages/cran/rms/docs/validate.rpart" rel="nofollow noreferrer">validate.rpart</a> with an rpart fit that includes a Surv object I get an error. Borrowing the example from the previous question: </p>
  
  <pre><code>library(rms)
  
  # Make Data:
  set.seed(4)
  dat = data.frame(X1 = sample(x = c(1,2,3,4,5), size = 100, replace=T))
  dat$t = rexp(100, rate=dat$X1)
  dat$t = dat$t / max(dat$t)
  dat$e = rbinom(n = 100, size = 1, prob = 1-dat$t )
  
  # Survival Fit:
  sfit = survfit(Surv(t, event = e) ~ 1, data=dat)
  plot(sfit)
  
  # Tree Fit:
  require(rpart)
  tfit = rpart(formula = Surv(t, event = e) ~ X1 , data = dat, model=TRUE, control=rpart.control(minsplit=30, cp=0.01))
  plot(tfit); text(tfit)
  validate(tfit)
  </code></pre>
  
  <p>The error:</p>
  
  <pre><code>Error in unclass(x)[i, , drop = FALSE] : 
  (subscript) logical subscript too long
  </code></pre>
  
  <p>Any idea for a workaround for this problem? Is there any other way to get the c-index from an rpart survival model?</p>