Running examples in 'LTRCtrees-Ex.R' failed
The error most likely occurred in:

> ### Name: Pred.rpart
> ### Title: Prediction function for rpart.object
> ### Aliases: Pred.rpart
> 
> ### ** Examples
> 
> ## The Assay of serum free light chain data in survival package
> ## Adjust data & clean data
> library(survival)
> library(LTRCtrees)
> Data <- flchain
> Data <- Data[!is.na(Data$creatinine),]
> Data$End <- Data$age + Data$futime/365
> DATA <- Data[Data$End > Data$age,]
> names(DATA)[6] <- "FLC"
> 
> ## Setup training set and test set
> Train = DATA[1:500,]
> Test = DATA[1000:1020,]
> 
> ## Predict median survival time and Kaplan Meier survival curve
> ## on test data using Pred.rpart
> LTRCART.pred <- Pred.rpart(Surv(age, End, death) ~ sex + FLC + creatinine, Train, Test)
> LTRCART.pred$KMcurves  ## list of predicted KM curves
[[1]]
Call: survfit(formula = Formula, data = subset)

records   n.max n.start  events  median 0.95LCL 0.95UCL 
  248.0   144.0     0.0   189.0    90.5    88.4    91.4 

[[2]]
Call: survfit(formula = Formula, data = subset)

records   n.max n.start  events  median 0.95LCL 0.95UCL 
  248.0   144.0     0.0   189.0    90.5    88.4    91.4 

[[3]]
Call: survfit(formula = Formula, data = subset)

records   n.max n.start  events  median 0.95LCL 0.95UCL 
  248.0   144.0     0.0   189.0    90.5    88.4    91.4 

[[4]]
Call: survfit(formula = Formula, data = subset)

records   n.max n.start  events  median 0.95LCL 0.95UCL 
  248.0   144.0     0.0   189.0    90.5    88.4    91.4 

[[5]]
Call: survfit(formula = Formula, data = subset)

records   n.max n.start  events  median 0.95LCL 0.95UCL 
  248.0   144.0     0.0   189.0    90.5    88.4    91.4 

[[6]]
Call: survfit(formula = Formula, data = subset)

records   n.max n.start  events  median 0.95LCL 0.95UCL 
  144.0    56.0     0.0   131.0    83.8    81.0    86.7 

[[7]]
Call: survfit(formula = Formula, data = subset)

records   n.max n.start  events  median 0.95LCL 0.95UCL 
  248.0   144.0     0.0   189.0    90.5    88.4    91.4 

[[8]]
Call: survfit(formula = Formula, data = subset)

records   n.max n.start  events  median 0.95LCL 0.95UCL 
  248.0   144.0     0.0   189.0    90.5    88.4    91.4 

[[9]]
Call: survfit(formula = Formula, data = subset)

records   n.max n.start  events  median 0.95LCL 0.95UCL 
  248.0   144.0     0.0   189.0    90.5    88.4    91.4 

[[10]]
Call: survfit(formula = Formula, data = subset)

records   n.max n.start  events  median 0.95LCL 0.95UCL 
  248.0   144.0     0.0   189.0    90.5    88.4    91.4 

[[11]]
Call: survfit(formula = Formula, data = subset)

records   n.max n.start  events  median 0.95LCL 0.95UCL 
  248.0   144.0     0.0   189.0    90.5    88.4    91.4 

[[12]]
Call: survfit(formula = Formula, data = subset)

records   n.max n.start  events  median 0.95LCL 0.95UCL 
  248.0   144.0     0.0   189.0    90.5    88.4    91.4 

[[13]]
Call: survfit(formula = Formula, data = subset)

records   n.max n.start  events  median 0.95LCL 0.95UCL 
  144.0    56.0     0.0   131.0    83.8    81.0    86.7 

[[14]]
Call: survfit(formula = Formula, data = subset)

records   n.max n.start  events  median 0.95LCL 0.95UCL 
  248.0   144.0     0.0   189.0    90.5    88.4    91.4 

[[15]]
Call: survfit(formula = Formula, data = subset)

records   n.max n.start  events  median 0.95LCL 0.95UCL 
   86.0    47.0     0.0    75.0    87.0    84.2    89.3 

[[16]]
Call: survfit(formula = Formula, data = subset)

records   n.max n.start  events  median 0.95LCL 0.95UCL 
  248.0   144.0     0.0   189.0    90.5    88.4    91.4 

[[17]]
Call: survfit(formula = Formula, data = subset)

records   n.max n.start  events  median 0.95LCL 0.95UCL 
  248.0   144.0     0.0   189.0    90.5    88.4    91.4 

[[18]]
Call: survfit(formula = Formula, data = subset)

records   n.max n.start  events  median 0.95LCL 0.95UCL 
  248.0   144.0     0.0   189.0    90.5    88.4    91.4 

[[19]]
Call: survfit(formula = Formula, data = subset)

records   n.max n.start  events  median 0.95LCL 0.95UCL 
  248.0   144.0     0.0   189.0    90.5    88.4    91.4 

[[20]]
Call: survfit(formula = Formula, data = subset)

records   n.max n.start  events  median 0.95LCL 0.95UCL 
  144.0    56.0     0.0   131.0    83.8    81.0    86.7 

[[21]]
Call: survfit(formula = Formula, data = subset)

records   n.max n.start  events  median 0.95LCL 0.95UCL 
  144.0    56.0     0.0   131.0    83.8    81.0    86.7 

> LTRCART.pred$Medians  ## vector of predicted median survival time
 [1] 90.5 90.5 90.5 90.5 90.5 83.8 90.5 90.5 90.5 90.5 90.5 90.5 83.8 90.5 87.0
[16] 90.5 90.5 90.5 90.5 83.8 83.8
> 
> 
> 
> 
> ### * <FOOTER>
> ###
> cleanEx()

detaching 'package:survival'

Error: connections left open:
	utils::capture.output(KM) (textConnection)
	utils::capture.output(KM) (textConnection)
	utils::capture.output(KM) (textConnection)
Execution halted