Running ‘test.rpart.plot.R’ [1s/1s]
Running the tests in ‘tests/test.rpart.plot.R’ failed.
Complete output:
  > # test.rpart.plot.R
  > # Check for porting problems by building a few simple models.
  > # For much more comprehensive tests see rpart.plot\inst\slowtests.
  > library(rpart.plot)
  Loading required package: rpart
  > data(trees)     # anova model
  > Volume <- rpart(Volume~., data=trees)
  > print(rpart.rules(Volume, digits=5))
   Volume                             
   17.933 when Girth <  12.45         
   30.533 when Girth is 12.45 to 16.15
   55.929 when Girth >=          16.15
  > data(ptitanic)  # binomial model
  > ptitanic1 <- ptitanic
  > ptitanic1$female <- ptitanic1$sex == "female" # logical variable
  > ptitanic1$sex <- NULL
  > ptitanic1$parch <- NULL
  > survived <- rpart(survived ~ ., data=ptitanic1, method="class")
  > print(rpart.rules(survived, clip.facs=TRUE))
   survived                                                                
       0.05 when not female & age <   9.5         & sibsp >= 3             
       0.14 when female                           & sibsp >= 3 &        3rd
       0.17 when not female & age >=          9.5                          
       0.38 when female     & age >=         27.5 & sibsp <  3 &        3rd
       0.39 when female     & age is 16.5 to 21.5 & sibsp <  3 &        3rd
       0.61 when female     & age is 21.5 to 27.5 & sibsp <  3 &        3rd
       0.73 when female     & age <  16.5         & sibsp <  3 &        3rd
       0.89 when not female & age <   9.5         & sibsp <  3             
       0.93 when female                                        & 1st or 2nd
  > options(digits=4) # avoid numerical discrepancies across machines and R versions
  > options(width=1e3)
  > print(head(rpart.predict(survived, rules=TRUE)))
  Error in `[[<-.data.frame`(`*tmp*`, i, value = c("because", "because",  : 
    replacement has 107 rows, data has 9
  Calls: print ... [<-.data.frame -> xpdrows.data.frame -> [[<- -> [[<-.data.frame
  Execution halted