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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: addExperiments
> ### Title: Add experiemts to the registry.
> ### Aliases: addExperiments Experiment
> 
> ### ** Examples
> 
> ### EXAMPLE 1 ###
> reg = makeExperimentRegistry(id = "example1", file.dir = tempfile())
Creating dir: /home/hornik/tmp/scratch/RtmpgZoqT7/file2d24625240507
Saving registry: /home/hornik/tmp/scratch/RtmpgZoqT7/file2d24625240507/registry.RData
> 
> # Define a problem:
> # Subsampling from the iris dataset.
> data(iris)
> subsample = function(static, ratio) {
+   n = nrow(static)
+   train = sample(n, floor(n * ratio))
+   test = setdiff(seq(n), train)
+   list(test = test, train = train)
+ }
> addProblem(reg, id = "iris", static = iris,
+            dynamic = subsample, seed = 123)
Writing problem files: /home/hornik/tmp/scratch/RtmpgZoqT7/file2d24625240507/problems/iris_static.RData, /home/hornik/tmp/scratch/RtmpgZoqT7/file2d24625240507/problems/iris_dynamic.RData
> 
> # Define algorithm "tree":
> # Decision tree on the iris dataset, modeling Species.
> tree.wrapper = function(static, dynamic, ...) {
+   library(rpart)
+   mod = rpart(Species ~ ., data = static[dynamic$train, ], ...)
+   pred = predict(mod, newdata = static[dynamic$test, ], type = "class")
+   table(static$Species[dynamic$test], pred)
+ }
> addAlgorithm(reg, id = "tree", fun = tree.wrapper)
Writing algorithm file: /home/hornik/tmp/scratch/RtmpgZoqT7/file2d24625240507/algorithms/tree.RData
> 
> # Define algorithm "forest":
> # Random forest on the iris dataset, modeling Species.
> forest.wrapper = function(static, dynamic, ...) {
+   library(randomForest)
+   mod = randomForest(Species ~ ., data = static, subset = dynamic$train, ...)
+   pred = predict(mod, newdata = static[dynamic$test, ])
+   table(static$Species[dynamic$test], pred)
+ }
> addAlgorithm(reg, id = "forest", fun = forest.wrapper)
Writing algorithm file: /home/hornik/tmp/scratch/RtmpgZoqT7/file2d24625240507/algorithms/forest.RData
> 
> # Define problem parameters:
> pars = list(ratio = c(0.67, 0.9))
> iris.design = makeDesign("iris", exhaustive = pars)
> 
> # Define decision tree parameters:
> pars = list(minsplit = c(10, 20), cp = c(0.01, 0.1))
> tree.design = makeDesign("tree", exhaustive = pars)
> 
> # Define random forest parameters:
> pars = list(ntree = c(100, 500))
> forest.design = makeDesign("forest", exhaustive = pars)
> 
> # Add experiments to the registry:
> # Use  previously defined experimental designs.
> addExperiments(reg, prob.designs = iris.design,
+                algo.designs = list(tree.design, forest.design),
+                repls = 2) # usually you would set repls to 100 or more.
Adding 12 experiments / 24 jobs to DB.
> 
> # Optional: Short summary over problems and algorithms.
> summarizeExperiments(reg)
  prob   algo .count
1 iris forest      8
2 iris   tree     16
> 
> # Optional: Test one decision tree job and one expensive (ntree = 1000)
> # random forest job. Use findExperiments to get the right job ids.
> do.tests = FALSE
> if (do.tests) {
+   id1 = findExperiments(reg, algo.pattern = "tree")[1]
+   id2 = findExperiments(reg, algo.pattern = "forest",
+                          algo.pars = (ntree == 1000))[1]
+   testJob(reg, id1)
+   testJob(reg, id2)
+ }
> 
> # Submit the jobs to the batch system
> submitJobs(reg)
Saving conf: /home/hornik/tmp/scratch/RtmpgZoqT7/file2d24625240507/conf.RData
Submitting 24 chunks / 24 jobs.
Cluster functions: Interactive.
Auto-mailer settings: start=none, done=none, error=none.

SubmitJobs |+                                                |   0% (00:00:00)
SubmitJobs |+                                                |   0% (00:00:00)
SubmitJobs |++                                               |   4% (00:00:00)
SubmitJobs |++++                                             |   8% (00:00:11)
SubmitJobs |++++++                                           |  12% (00:00:07)
SubmitJobs |++++++++                                         |  17% (00:00:10)
SubmitJobs |++++++++++                                       |  21% (00:00:07)
SubmitJobs |++++++++++++                                     |  25% (00:00:06)
SubmitJobs |++++++++++++++                                   |  29% (00:00:07)
SubmitJobs |++++++++++++++++                                 |  33% (00:00:06)
SubmitJobs |++++++++++++++++++                               |  38% (00:00:06)
SubmitJobs |++++++++++++++++++++                             |  42% (00:00:07)
SubmitJobs |++++++++++++++++++++++                           |  46% (00:00:05)
SubmitJobs |++++++++++++++++++++++++                         |  50% (00:00:05)
SubmitJobs |+++++++++++++++++++++++++++                      |  54% (00:00:05)
SubmitJobs |+++++++++++++++++++++++++++++                    |  58% (00:00:04)
SubmitJobs |+++++++++++++++++++++++++++++++                  |  62% (00:00:03)
SubmitJobs |+++++++++++++++++++++++++++++++++                |  67% (00:00:03)
SubmitJobs |+++++++++++++++++++++++++++++++++++              |  71% (00:00:02)
SubmitJobs |+++++++++++++++++++++++++++++++++++++            |  75% (00:00:02)
SubmitJobs |+++++++++++++++++++++++++++++++++++++++          |  79% (00:00:02)
SubmitJobs |+++++++++++++++++++++++++++++++++++++++++        |  83% (00:00:01)
SubmitJobs |+++++++++++++++++++++++++++++++++++++++++++      |  88% (00:00:01)
SubmitJobs |+++++++++++++++++++++++++++++++++++++++++++++    |  92% (00:00:00)
SubmitJobs |+++++++++++++++++++++++++++++++++++++++++++++++  |  96% (00:00:00)
SubmitJobs |+++++++++++++++++++++++++++++++++++++++++++++++++| 100% (00:00:00)
Sending 24 submit messages...
Might take some time, do not interrupt this!
> 
> # Calculate the misclassification rate for all (already done) jobs.
> reduce = function(job, res) {
+   n = sum(res)
+   list(mcr = (n-sum(diag(res)))/n)
+ }
> res = reduceResultsExperiments(reg, fun = reduce)
Syncing registry ...
Reducing 24 results...

reduceResultsExperiments |+                                  |   0% (00:00:00)
reduceResultsExperiments |+++++++++++++++++++++++++++++++++++| 100% (00:00:00)
> print(res)
   id prob ratio   algo   cp minsplit repl        mcr ntree
1   1 iris  0.67   tree 0.01       10    1 0.04000000    NA
2   2 iris  0.67   tree 0.01       10    2 0.04000000    NA
3   3 iris  0.67   tree 0.01       20    1 0.04000000    NA
4   4 iris  0.67   tree 0.01       20    2 0.04000000    NA
5   5 iris  0.67   tree 0.10       10    1 0.04000000    NA
6   6 iris  0.67   tree 0.10       10    2 0.04000000    NA
7   7 iris  0.67   tree 0.10       20    1 0.04000000    NA
8   8 iris  0.67   tree 0.10       20    2 0.04000000    NA
9   9 iris  0.67 forest   NA       NA    1 0.04000000   100
10 10 iris  0.67 forest   NA       NA    2 0.06000000   100
11 11 iris  0.67 forest   NA       NA    1 0.04000000   500
12 12 iris  0.67 forest   NA       NA    2 0.04000000   500
13 13 iris  0.90   tree 0.01       10    1 0.00000000    NA
14 14 iris  0.90   tree 0.01       10    2 0.06666667    NA
15 15 iris  0.90   tree 0.01       20    1 0.00000000    NA
16 16 iris  0.90   tree 0.01       20    2 0.06666667    NA
17 17 iris  0.90   tree 0.10       10    1 0.00000000    NA
18 18 iris  0.90   tree 0.10       10    2 0.06666667    NA
19 19 iris  0.90   tree 0.10       20    1 0.00000000    NA
20 20 iris  0.90   tree 0.10       20    2 0.06666667    NA
21 21 iris  0.90 forest   NA       NA    1 0.00000000   100
22 22 iris  0.90 forest   NA       NA    2 0.06666667   100
23 23 iris  0.90 forest   NA       NA    1 0.00000000   500
24 24 iris  0.90 forest   NA       NA    2 0.06666667   500
> 
> # Aggregate results using 'ddply' from package 'plyr':
> # Calculate the mean over all replications of identical experiments
> # (same problem, same algorithm and same parameters)
> library(plyr)
Error in library(plyr) : there is no package called ‘plyr’
Execution halted