Running examples in ‘RWeka-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: Weka_classifier_trees
> ### Title: R/Weka Classifier Trees
> ### Aliases: Weka_classifier_trees J48 LMT M5P DecisionStump plot.Weka_tree
> ###   parse_Weka_digraph
> ### Keywords: models regression classif tree
> 
> ### ** Examples
> 
> m1 <- J48(Species ~ ., data = iris)
> 
> ## print and summary
> m1
J48 pruned tree
------------------

Petal.Width <= 0.6: setosa (50.0)
Petal.Width > 0.6
|   Petal.Width <= 1.7
|   |   Petal.Length <= 4.9: versicolor (48.0/1.0)
|   |   Petal.Length > 4.9
|   |   |   Petal.Width <= 1.5: virginica (3.0)
|   |   |   Petal.Width > 1.5: versicolor (3.0/1.0)
|   Petal.Width > 1.7: virginica (46.0/1.0)

Number of Leaves  : 	5

Size of the tree : 	9

> summary(m1) # calls evaluate_Weka_classifier()

=== Summary ===

Correctly Classified Instances         147               98      %
Incorrectly Classified Instances         3                2      %
Kappa statistic                          0.97  
Mean absolute error                      0.0233
Root mean squared error                  0.108 
Relative absolute error                  5.2482 %
Root relative squared error             22.9089 %
Total Number of Instances              150     

=== Confusion Matrix ===

  a  b  c   <-- classified as
 50  0  0 |  a = setosa
  0 49  1 |  b = versicolor
  0  2 48 |  c = virginica
> table(iris$Species, predict(m1)) # by hand
            
             setosa versicolor virginica
  setosa         50          0         0
  versicolor      0         49         1
  virginica       0          2        48
> 
> ## visualization
> ## use partykit package
> if(require("partykit", quietly = TRUE)) plot(m1)
> ## or Graphviz
> write_to_dot(m1)
digraph J48Tree {
N0 [label="Petal.Width" ]
N0->N1 [label="<= 0.6"]
N1 [label="setosa (50.0)" shape=box style=filled ]
N0->N2 [label="> 0.6"]
N2 [label="Petal.Width" ]
N2->N3 [label="<= 1.7"]
N3 [label="Petal.Length" ]
N3->N4 [label="<= 4.9"]
N4 [label="versicolor (48.0/1.0)" shape=box style=filled ]
N3->N5 [label="> 4.9"]
N5 [label="Petal.Width" ]
N5->N6 [label="<= 1.5"]
N6 [label="virginica (3.0)" shape=box style=filled ]
N5->N7 [label="> 1.5"]
N7 [label="versicolor (3.0/1.0)" shape=box style=filled ]
N2->N8 [label="> 1.7"]
N8 [label="virginica (46.0/1.0)" shape=box style=filled ]
}

> ## or Rgraphviz
> ## Not run: 
> ##D library("Rgraphviz")
> ##D ff <- tempfile()
> ##D write_to_dot(m1, ff)
> ##D plot(agread(ff))
> ## End(Not run)
> ## The first uses the Weka digraph for the classifier tree
> di <- rJava::.jcall(m1$classifier, "S", "graph")
> writeLines(di)
digraph J48Tree {
N0 [label="Petal.Width" ]
N0->N1 [label="<= 0.6"]
N1 [label="setosa (50.0)" shape=box style=filled ]
N0->N2 [label="> 0.6"]
N2 [label="Petal.Width" ]
N2->N3 [label="<= 1.7"]
N3 [label="Petal.Length" ]
N3->N4 [label="<= 4.9"]
N4 [label="versicolor (48.0/1.0)" shape=box style=filled ]
N3->N5 [label="> 4.9"]
N5 [label="Petal.Width" ]
N5->N6 [label="<= 1.5"]
N6 [label="virginica (3.0)" shape=box style=filled ]
N5->N7 [label="> 1.5"]
N7 [label="versicolor (3.0/1.0)" shape=box style=filled ]
N2->N8 [label="> 1.7"]
N8 [label="virginica (46.0/1.0)" shape=box style=filled ]
}

> ## for which we can extract the information about nodes and edges via
> parse_Weka_digraph(di)
$nodes
      name splitvar      
 [1,] "N0" "Petal.Width" 
 [2,] "N1" ""            
 [3,] "N2" "Petal.Width" 
 [4,] "N3" "Petal.Length"
 [5,] "N4" ""            
 [6,] "N5" "Petal.Width" 
 [7,] "N6" ""            
 [8,] "N7" ""            
 [9,] "N8" ""            

$edges
     from to   label   
[1,] "N0" "N1" "<= 0.6"
[2,] "N0" "N2" "> 0.6" 
[3,] "N2" "N3" "<= 1.7"
[4,] "N3" "N4" "<= 4.9"
[5,] "N3" "N5" "> 4.9" 
[6,] "N5" "N6" "<= 1.5"
[7,] "N5" "N7" "> 1.5" 
[8,] "N2" "N8" "> 1.7" 

> 
> ## Using some Weka data sets ...
> 
> ## J48
> DF2 <- read.arff(system.file("arff", "contact-lenses.arff",
+                              package = "RWeka"))
> m2 <- J48(`contact-lenses` ~ ., data = DF2)
> m2
J48 pruned tree
------------------

tear-prod-rate = reduced: none (12.0)
tear-prod-rate = normal
|   astigmatism = no: soft (6.0/1.0)
|   astigmatism = yes
|   |   spectacle-prescrip = myope: hard (3.0)
|   |   spectacle-prescrip = hypermetrope: none (3.0/1.0)

Number of Leaves  : 	4

Size of the tree : 	7

> table(DF2$`contact-lenses`, predict(m2))
      
       soft hard none
  soft    5    0    0
  hard    0    3    1
  none    1    0   14
> if(require("partykit", quietly = TRUE)) plot(m2)
> 
> ## M5P
> DF3 <- read.arff(system.file("arff", "cpu.arff", package = "RWeka"))
> m3 <- M5P(class ~ ., data = DF3)
> m3
M5 pruned model tree:
(using smoothed linear models)

CHMIN <= 7.5 : 
|   MMAX <= 6100 : LM1 (76/7.046%)
|   MMAX >  6100 : 
|   |   CACH <= 28 : 
|   |   |   CACH <= 0.5 : LM2 (20/7.795%)
|   |   |   CACH >  0.5 : 
|   |   |   |   CHMIN <= 3.5 : LM3 (34/11.658%)
|   |   |   |   CHMIN >  3.5 : LM4 (9/12.866%)
|   |   CACH >  28 : LM5 (26/19.269%)
CHMIN >  7.5 : 
|   MMAX <= 28000 : 
|   |   MMAX <= 13240 : 
|   |   |   CACH <= 81.5 : LM6 (6/18.551%)
|   |   |   CACH >  81.5 : LM7 (4/30.824%)
|   |   MMAX >  13240 : LM8 (11/24.185%)
|   MMAX >  28000 : LM9 (23/48.302%)

LM num: 1
class = 
	0.0025 * MMIN 
	+ 0.004 * MMAX 
	+ 0.0009 * CACH 
	+ 0.1758 * CHMIN 
	+ 0.205 * CHMAX 
	+ 7.6605

LM num: 2
class = 
	-0.012 * MYCT 
	- 0.0141 * MMIN 
	+ 0.0013 * MMAX 
	+ 0.0017 * CACH 
	+ 0.2793 * CHMIN 
	+ 0.6771 * CHMAX 
	+ 26.4438

LM num: 3
class = 
	-0.0096 * MMIN 
	+ 0.0028 * MMAX 
	+ 0.0018 * CACH 
	+ 0.2793 * CHMIN 
	+ 0.4086 * CHMAX 
	+ 24.6136

LM num: 4
class = 
	-0.0406 * MYCT 
	- 0.0096 * MMIN 
	+ 0.0033 * MMAX 
	- 0.294 * CACH 
	+ 0.2793 * CHMIN 
	+ 0.4086 * CHMAX 
	+ 38.0329

LM num: 5
class = 
	-0.0077 * MMIN 
	+ 0.0024 * MMAX 
	+ 0.3125 * CACH 
	+ 0.3866 * CHMIN 
	+ 0.5207 * CHMAX 
	+ 17.2559

LM num: 6
class = 
	-0.5146 * MYCT 
	- 0.516 * MMIN 
	+ 0.0086 * MMAX 
	+ 0.3906 * CACH 
	- 2.0512 * CHMIN 
	+ 70.8672

LM num: 7
class = 
	-0.5896 * MYCT 
	- 0.516 * MMIN 
	+ 0.0086 * MMAX 
	+ 0.4034 * CACH 
	- 2.0512 * CHMIN 
	+ 83.0016

LM num: 8
class = 
	-0.3653 * MYCT 
	- 0.516 * MMIN 
	+ 0.0086 * MMAX 
	+ 0.2587 * CACH 
	- 1.957 * CHMIN 
	+ 82.5725

LM num: 9
class = 
	-0.4748 * MMIN 
	+ 0.0083 * MMAX 
	+ 0.003 * CACH 
	- 0.9387 * CHMIN 
	+ 2.2489 * CHMAX 
	- 51.8474

Number of Rules : 9
> if(require("partykit", quietly = TRUE)) plot(m3)
> 
> ## Logistic Model Tree.
> DF4 <- read.arff(system.file("arff", "weather.arff", package = "RWeka"))
> m4 <- LMT(play ~ ., data = DF4)
> m4
Logistic model tree 
------------------
: LM_1:11/11 (14)

Number of Leaves  : 	1

Size of the Tree : 	1
LM_1:
Class yes :
6.95 + 
[outlook=sunny] * -0.65 +
[outlook=overcast] * 2.82 +
[temperature] * -0.02 +
[humidity] * -0.06 +
[windy=TRUE] * -1.38

Class no :
-6.95 + 
[outlook=sunny] * 0.65 +
[outlook=overcast] * -2.82 +
[temperature] * 0.02 +
[humidity] * 0.06 +
[windy=TRUE] * 1.38

> table(DF4$play, predict(m4))
     
      yes no
  yes   8  1
  no    1  4
> 
> ## Larger scale example.
> if(require("mlbench", quietly = TRUE)
+    && require("partykit", quietly = TRUE)) {
+     ## Predict diabetes status for Pima Indian women
+     data("PimaIndiansDiabetes", package = "mlbench")
+     ## Fit J48 tree with reduced error pruning
+     m5 <- J48(diabetes ~ ., data = PimaIndiansDiabetes,
+               control = Weka_control(R = TRUE))
+     plot(m5)
+     ## (Make sure that the plotting device is big enough for the tree.)
+ }
Warning in data("PimaIndiansDiabetes", package = "mlbench") :
  data set ‘PimaIndiansDiabetes’ not found
Error in eval(mf, parent.frame()) : 
  object 'PimaIndiansDiabetes' not found
Calls: J48 ... <Anonymous> -> model.frame.default -> is.data.frame
Execution halted