diff --git a/.Rbuildignore b/.Rbuildignore
index e4e5d139..e091ec2d 100644
--- a/.Rbuildignore
+++ b/.Rbuildignore
@@ -3,3 +3,4 @@
^.*\.Rproj$
^\.Rproj\.user$
^tests/upgrades$
+^examples$
diff --git a/examples/iris.jasp b/examples/iris.jasp
new file mode 100644
index 00000000..f153e9b7
Binary files /dev/null and b/examples/iris.jasp differ
diff --git a/examples/penguins.jasp b/examples/penguins.jasp
new file mode 100644
index 00000000..1f0935ed
Binary files /dev/null and b/examples/penguins.jasp differ
diff --git a/examples/policeCadetEvaluation.jasp b/examples/policeCadetEvaluation.jasp
new file mode 100644
index 00000000..89cc3b5e
Binary files /dev/null and b/examples/policeCadetEvaluation.jasp differ
diff --git a/examples/spiral.jasp b/examples/spiral.jasp
new file mode 100644
index 00000000..bb70dc95
Binary files /dev/null and b/examples/spiral.jasp differ
diff --git a/examples/studentGrades.jasp b/examples/studentGrades.jasp
new file mode 100644
index 00000000..c32868fd
Binary files /dev/null and b/examples/studentGrades.jasp differ
diff --git a/examples/telcoCustomerChurn.jasp b/examples/telcoCustomerChurn.jasp
new file mode 100644
index 00000000..f6d381b6
Binary files /dev/null and b/examples/telcoCustomerChurn.jasp differ
diff --git a/examples/wine.jasp b/examples/wine.jasp
new file mode 100644
index 00000000..12091451
Binary files /dev/null and b/examples/wine.jasp differ
diff --git a/tests/testthat/_snaps/example-iris/analysis-1-figure-1-all-features.svg b/tests/testthat/_snaps/example-iris/analysis-1-figure-1-all-features.svg
new file mode 100644
index 00000000..76cfe645
--- /dev/null
+++ b/tests/testthat/_snaps/example-iris/analysis-1-figure-1-all-features.svg
@@ -0,0 +1,96 @@
+
+
diff --git a/tests/testthat/_snaps/example-iris/analysis-1-figure-2-t-sne-cluster-plot.svg b/tests/testthat/_snaps/example-iris/analysis-1-figure-2-t-sne-cluster-plot.svg
new file mode 100644
index 00000000..dd1f1788
--- /dev/null
+++ b/tests/testthat/_snaps/example-iris/analysis-1-figure-2-t-sne-cluster-plot.svg
@@ -0,0 +1,200 @@
+
+
diff --git a/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-1.svg b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-1.svg
new file mode 100644
index 00000000..8d5d7444
--- /dev/null
+++ b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-1.svg
@@ -0,0 +1,34 @@
+
+
diff --git a/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-10.svg b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-10.svg
new file mode 100644
index 00000000..4088e3b0
--- /dev/null
+++ b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-10.svg
@@ -0,0 +1,34 @@
+
+
diff --git a/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-11.svg b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-11.svg
new file mode 100644
index 00000000..cf09c1f9
--- /dev/null
+++ b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-11.svg
@@ -0,0 +1,382 @@
+
+
diff --git a/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-12.svg b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-12.svg
new file mode 100644
index 00000000..805fefa4
--- /dev/null
+++ b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-12.svg
@@ -0,0 +1,401 @@
+
+
diff --git a/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-13.svg b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-13.svg
new file mode 100644
index 00000000..9b33acf0
--- /dev/null
+++ b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-13.svg
@@ -0,0 +1,401 @@
+
+
diff --git a/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-14.svg b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-14.svg
new file mode 100644
index 00000000..ce41d278
--- /dev/null
+++ b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-14.svg
@@ -0,0 +1,399 @@
+
+
diff --git a/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-15.svg b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-15.svg
new file mode 100644
index 00000000..5963a59d
--- /dev/null
+++ b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-15.svg
@@ -0,0 +1,34 @@
+
+
diff --git a/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-16.svg b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-16.svg
new file mode 100644
index 00000000..05890c53
--- /dev/null
+++ b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-16.svg
@@ -0,0 +1,401 @@
+
+
diff --git a/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-17.svg b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-17.svg
new file mode 100644
index 00000000..a83dcab9
--- /dev/null
+++ b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-17.svg
@@ -0,0 +1,399 @@
+
+
diff --git a/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-18.svg b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-18.svg
new file mode 100644
index 00000000..689f486f
--- /dev/null
+++ b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-18.svg
@@ -0,0 +1,34 @@
+
+
diff --git a/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-19.svg b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-19.svg
new file mode 100644
index 00000000..decb72c1
--- /dev/null
+++ b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-19.svg
@@ -0,0 +1,399 @@
+
+
diff --git a/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-2.svg b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-2.svg
new file mode 100644
index 00000000..8e2fb389
--- /dev/null
+++ b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-2.svg
@@ -0,0 +1,34 @@
+
+
diff --git a/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-3.svg b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-3.svg
new file mode 100644
index 00000000..87f20486
--- /dev/null
+++ b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-3.svg
@@ -0,0 +1,34 @@
+
+
diff --git a/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-4.svg b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-4.svg
new file mode 100644
index 00000000..7671fd35
--- /dev/null
+++ b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-4.svg
@@ -0,0 +1,34 @@
+
+
diff --git a/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-5.svg b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-5.svg
new file mode 100644
index 00000000..07dd11ea
--- /dev/null
+++ b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-5.svg
@@ -0,0 +1,34 @@
+
+
diff --git a/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-6.svg b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-6.svg
new file mode 100644
index 00000000..5ea182e5
--- /dev/null
+++ b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-6.svg
@@ -0,0 +1,401 @@
+
+
diff --git a/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-7.svg b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-7.svg
new file mode 100644
index 00000000..d26e1c17
--- /dev/null
+++ b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-7.svg
@@ -0,0 +1,401 @@
+
+
diff --git a/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-8.svg b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-8.svg
new file mode 100644
index 00000000..fadd6e68
--- /dev/null
+++ b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-8.svg
@@ -0,0 +1,401 @@
+
+
diff --git a/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-9.svg b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-9.svg
new file mode 100644
index 00000000..4aed58eb
--- /dev/null
+++ b/tests/testthat/_snaps/example-penguins/analysis-1-figure-1-decision-boundary-matrix-subplot-9.svg
@@ -0,0 +1,399 @@
+
+
diff --git a/tests/testthat/_snaps/example-penguins/analysis-1-figure-2-decision-tree-plot.svg b/tests/testthat/_snaps/example-penguins/analysis-1-figure-2-decision-tree-plot.svg
new file mode 100644
index 00000000..b48d8fe3
--- /dev/null
+++ b/tests/testthat/_snaps/example-penguins/analysis-1-figure-2-decision-tree-plot.svg
@@ -0,0 +1,94 @@
+
+
diff --git a/tests/testthat/_snaps/example-penguins/analysis-1-figure-3-data-split.svg b/tests/testthat/_snaps/example-penguins/analysis-1-figure-3-data-split.svg
new file mode 100644
index 00000000..95c9d9a0
--- /dev/null
+++ b/tests/testthat/_snaps/example-penguins/analysis-1-figure-3-data-split.svg
@@ -0,0 +1,42 @@
+
+
diff --git a/tests/testthat/_snaps/example-penguins/analysis-1-figure-4-roc-curves-plot.svg b/tests/testthat/_snaps/example-penguins/analysis-1-figure-4-roc-curves-plot.svg
new file mode 100644
index 00000000..5d4d5218
--- /dev/null
+++ b/tests/testthat/_snaps/example-penguins/analysis-1-figure-4-roc-curves-plot.svg
@@ -0,0 +1,84 @@
+
+
diff --git a/tests/testthat/_snaps/example-policeCadetEvaluation/analysis-1-figure-1-decision-tree-plot.svg b/tests/testthat/_snaps/example-policeCadetEvaluation/analysis-1-figure-1-decision-tree-plot.svg
new file mode 100644
index 00000000..60c7b119
--- /dev/null
+++ b/tests/testthat/_snaps/example-policeCadetEvaluation/analysis-1-figure-1-decision-tree-plot.svg
@@ -0,0 +1,141 @@
+
+
diff --git a/tests/testthat/_snaps/example-policeCadetEvaluation/analysis-1-figure-2-data-split.svg b/tests/testthat/_snaps/example-policeCadetEvaluation/analysis-1-figure-2-data-split.svg
new file mode 100644
index 00000000..c50fc1c3
--- /dev/null
+++ b/tests/testthat/_snaps/example-policeCadetEvaluation/analysis-1-figure-2-data-split.svg
@@ -0,0 +1,42 @@
+
+
diff --git a/tests/testthat/_snaps/example-spiral/analysis-1-figure-1-decision-boundary-matrix-subplot-1.svg b/tests/testthat/_snaps/example-spiral/analysis-1-figure-1-decision-boundary-matrix-subplot-1.svg
new file mode 100644
index 00000000..49ea6b1c
--- /dev/null
+++ b/tests/testthat/_snaps/example-spiral/analysis-1-figure-1-decision-boundary-matrix-subplot-1.svg
@@ -0,0 +1,34 @@
+
+
diff --git a/tests/testthat/_snaps/example-spiral/analysis-1-figure-1-decision-boundary-matrix-subplot-2.svg b/tests/testthat/_snaps/example-spiral/analysis-1-figure-1-decision-boundary-matrix-subplot-2.svg
new file mode 100644
index 00000000..09f7f50e
--- /dev/null
+++ b/tests/testthat/_snaps/example-spiral/analysis-1-figure-1-decision-boundary-matrix-subplot-2.svg
@@ -0,0 +1,34 @@
+
+
diff --git a/tests/testthat/_snaps/example-spiral/analysis-1-figure-1-decision-boundary-matrix-subplot-3.svg b/tests/testthat/_snaps/example-spiral/analysis-1-figure-1-decision-boundary-matrix-subplot-3.svg
new file mode 100644
index 00000000..e08802b7
--- /dev/null
+++ b/tests/testthat/_snaps/example-spiral/analysis-1-figure-1-decision-boundary-matrix-subplot-3.svg
@@ -0,0 +1,273 @@
+
+
diff --git a/tests/testthat/_snaps/example-spiral/analysis-1-figure-2-data-split.svg b/tests/testthat/_snaps/example-spiral/analysis-1-figure-2-data-split.svg
new file mode 100644
index 00000000..af7d2654
--- /dev/null
+++ b/tests/testthat/_snaps/example-spiral/analysis-1-figure-2-data-split.svg
@@ -0,0 +1,42 @@
+
+
diff --git a/tests/testthat/_snaps/example-studentGrades/analysis-1-figure-1-data-split.svg b/tests/testthat/_snaps/example-studentGrades/analysis-1-figure-1-data-split.svg
new file mode 100644
index 00000000..f746444d
--- /dev/null
+++ b/tests/testthat/_snaps/example-studentGrades/analysis-1-figure-1-data-split.svg
@@ -0,0 +1,44 @@
+
+
diff --git a/tests/testthat/_snaps/example-studentGrades/analysis-1-figure-2-predictive-performance-plot.svg b/tests/testthat/_snaps/example-studentGrades/analysis-1-figure-2-predictive-performance-plot.svg
new file mode 100644
index 00000000..7fa2c0f1
--- /dev/null
+++ b/tests/testthat/_snaps/example-studentGrades/analysis-1-figure-2-predictive-performance-plot.svg
@@ -0,0 +1,141 @@
+
+
diff --git a/tests/testthat/_snaps/example-wine/analysis-1-figure-1-elbow-method-plot.svg b/tests/testthat/_snaps/example-wine/analysis-1-figure-1-elbow-method-plot.svg
new file mode 100644
index 00000000..02118565
--- /dev/null
+++ b/tests/testthat/_snaps/example-wine/analysis-1-figure-1-elbow-method-plot.svg
@@ -0,0 +1,81 @@
+
+
diff --git a/tests/testthat/_snaps/example-wine/analysis-1-figure-2-t-sne-cluster-plot.svg b/tests/testthat/_snaps/example-wine/analysis-1-figure-2-t-sne-cluster-plot.svg
new file mode 100644
index 00000000..762b3acf
--- /dev/null
+++ b/tests/testthat/_snaps/example-wine/analysis-1-figure-2-t-sne-cluster-plot.svg
@@ -0,0 +1,229 @@
+
+
diff --git a/tests/testthat/test-example-iris.R b/tests/testthat/test-example-iris.R
new file mode 100644
index 00000000..29c844e2
--- /dev/null
+++ b/tests/testthat/test-example-iris.R
@@ -0,0 +1,41 @@
+context("Example: iris")
+
+# This test file was auto-generated from a JASP example file.
+# The JASP file is stored in the module's examples/ folder.
+
+test_that("mlClusteringKMeans results match", {
+
+ # Load from JASP example file
+ jaspFile <- testthat::test_path("..", "..", "examples", "iris.jasp")
+ opts <- jaspTools::analysisOptions(jaspFile)
+ dataset <- jaspTools::extractDatasetFromJASPFile(jaspFile)
+
+ # Encode and run analysis
+ encoded <- jaspTools:::encodeOptionsAndDataset(opts, dataset)
+ set.seed(1)
+ results <- jaspTools::runAnalysis("mlClusteringKMeans", encoded$dataset, encoded$options, encodedDataset = TRUE)
+
+ plotName <- results[["results"]][["clusterDensities"]][["collection"]][["clusterDensities_oneFigure"]][["data"]]
+ testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
+ jaspTools::expect_equal_plots(testPlot, "analysis-1_figure-1_all-features")
+
+ table <- results[["results"]][["clusterInfoTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(-1.01119138320281, 0.850413715115632, -1.30063008999938, -1.25070351696687,
+ 1, 0.340925770899256, 0.636316174439295, 50, 47.3506211055712,
+ -0.0500522113876544, -0.880426958760276, 0.346576747898886,
+ 0.280587305699797, 2, 0.31743153016038, 0.393377210558143, 53,
+ 44.0875445465443, 1.13217736944013, 0.0881264480534628, 0.992828443858037,
+ 1.01412869460115, 3, 0.341642698940364, 0.347392234026205, 47,
+ 47.450194065236))
+
+ table <- results[["results"]][["clusteringTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(0.46, 162.89, 199.02, 3, 0.766965839400417, 150))
+
+ plotName <- results[["results"]][["plot2dCluster"]][["data"]]
+ testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
+ jaspTools::expect_equal_plots(testPlot, "analysis-1_figure-2_t-sne-cluster-plot")
+
+})
+
diff --git a/tests/testthat/test-example-penguins.R b/tests/testthat/test-example-penguins.R
new file mode 100644
index 00000000..a3221081
--- /dev/null
+++ b/tests/testthat/test-example-penguins.R
@@ -0,0 +1,53 @@
+context("Example: penguins")
+
+# This test file was auto-generated from a JASP example file.
+# The JASP file is stored in the module's examples/ folder.
+
+test_that("mlClassificationDecisionTree results match", {
+
+ # Load from JASP example file
+ jaspFile <- testthat::test_path("..", "..", "examples", "penguins.jasp")
+ opts <- jaspTools::analysisOptions(jaspFile)
+ dataset <- jaspTools::extractDatasetFromJASPFile(jaspFile)
+
+ # Encode and run analysis
+ encoded <- jaspTools:::encodeOptionsAndDataset(opts, dataset)
+ set.seed(1)
+ results <- jaspTools::runAnalysis("mlClassificationDecisionTree", encoded$dataset, encoded$options, encodedDataset = TRUE)
+
+ table <- results[["results"]][["classificationTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(33, 300, 0.01, 22, 1))
+
+ table <- results[["results"]][["confusionTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list("Observed", "Adelie", 17, 0, 0, "", "Chinstrap", 0, 10, 0, "",
+ "Gentoo", 0, 0, 6))
+
+ plotName <- results[["results"]][["decisionBoundary"]][["data"]]
+ testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
+ jaspTools::expect_equal_plots(testPlot, "analysis-1_figure-1_decision-boundary-matrix")
+
+ plotName <- results[["results"]][["decisionTreePlot"]][["data"]]
+ testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
+ jaspTools::expect_equal_plots(testPlot, "analysis-1_figure-2_decision-tree-plot")
+
+ plotName <- results[["results"]][["plotDataSplit"]][["data"]]
+ testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
+ jaspTools::expect_equal_plots(testPlot, "analysis-1_figure-3_data-split")
+
+ plotName <- results[["results"]][["rocCurve"]][["data"]]
+ testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
+ jaspTools::expect_equal_plots(testPlot, "analysis-1_figure-4_roc-curves-plot")
+
+ table <- results[["results"]][["validationMeasures"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(1, 0.970588235294118, 1, 0, 0, 0, 0, "Adelie", 1, 1, 1, 1, 0.515151515151515,
+ 17, 1, "", 1, 1, 1, 0, 0, 0, 0, "Chinstrap", 1, 1,
+ 1, 1, 0.303030303030303, 10, 1, "", 1, 1, 1, 0, 0,
+ 0, 0, "Gentoo", 1, 1, 1, 1, 0.181818181818182, 6, 1, "",
+ 1, 0.990196078431373, 1, 0, 0, 0, 0, "Average / Total", 1, 1,
+ 1, 1, 1, 33, 1, ""))
+
+})
+
diff --git a/tests/testthat/test-example-policeCadetEvaluation.R b/tests/testthat/test-example-policeCadetEvaluation.R
new file mode 100644
index 00000000..edbeb74c
--- /dev/null
+++ b/tests/testthat/test-example-policeCadetEvaluation.R
@@ -0,0 +1,43 @@
+context("Example: policeCadetEvaluation")
+
+# This test file was auto-generated from a JASP example file.
+# The JASP file is stored in the module's examples/ folder.
+
+test_that("mlClassificationDecisionTree results match", {
+
+ # Load from JASP example file
+ jaspFile <- testthat::test_path("..", "..", "examples", "policeCadetEvaluation.jasp")
+ opts <- jaspTools::analysisOptions(jaspFile)
+ dataset <- jaspTools::extractDatasetFromJASPFile(jaspFile)
+
+ # Encode and run analysis
+ encoded <- jaspTools:::encodeOptionsAndDataset(opts, dataset)
+ set.seed(1)
+ results <- jaspTools::runAnalysis("mlClassificationDecisionTree", encoded$dataset, encoded$options, encodedDataset = TRUE)
+
+ table <- results[["results"]][["classificationTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(400, 1600, 0.001, 22, 0.79))
+
+ table <- results[["results"]][["confusionTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list("Observed", "Fail", 0, 81, "", "Pass", 3, 316))
+
+ plotName <- results[["results"]][["decisionTreePlot"]][["data"]]
+ testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
+ jaspTools::expect_equal_plots(testPlot, "analysis-1_figure-1_decision-tree-plot")
+
+ plotName <- results[["results"]][["plotDataSplit"]][["data"]]
+ testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
+ jaspTools::expect_equal_plots(testPlot, "analysis-1_figure-2_data-split")
+
+ table <- results[["results"]][["splitsTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(1600, 40.9912821282016, 0.5, "jaspColumn3", 739, 1.25676113142475,
+ 0.5, "jaspColumn2", 524, 0.65386154342491, 5, "jaspColumn4",
+ 501, 0.695752656461394, 7, "jaspColumn5", 63, 3.30687830687831,
+ 26.5, "jaspColumn1", 215, 1.31686685407615, 39.5, "jaspColumn1"
+ ))
+
+})
+
diff --git a/tests/testthat/test-example-spiral.R b/tests/testthat/test-example-spiral.R
new file mode 100644
index 00000000..e7219592
--- /dev/null
+++ b/tests/testthat/test-example-spiral.R
@@ -0,0 +1,48 @@
+context("Example: spiral")
+
+# This test file was auto-generated from a JASP example file.
+# The JASP file is stored in the module's examples/ folder.
+
+test_that("mlClassificationSvm results match", {
+
+ # Load from JASP example file
+ jaspFile <- testthat::test_path("..", "..", "examples", "spiral.jasp")
+ opts <- jaspTools::analysisOptions(jaspFile)
+ dataset <- jaspTools::extractDatasetFromJASPFile(jaspFile)
+
+ # Encode and run analysis
+ encoded <- jaspTools:::encodeOptionsAndDataset(opts, dataset)
+ set.seed(1)
+ results <- jaspTools::runAnalysis("mlClassificationSvm", encoded$dataset, encoded$options, encodedDataset = TRUE)
+
+ table <- results[["results"]][["classificationTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(1, 40, 160, 0.8, 124))
+
+ table <- results[["results"]][["confusionTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list("Observed", "Black", 13, 3, "", "Red", 5, 19))
+
+ plotName <- results[["results"]][["decisionBoundary"]][["data"]]
+ testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
+ jaspTools::expect_equal_plots(testPlot, "analysis-1_figure-1_decision-boundary-matrix")
+
+ plotName <- results[["results"]][["plotDataSplit"]][["data"]]
+ testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
+ jaspTools::expect_equal_plots(testPlot, "analysis-1_figure-2_data-split")
+
+ table <- results[["results"]][["validationMeasures"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(0.8, 0.802083333333333, 0.764705882352941, 0.277777777777778,
+ 0.1875, 0.136363636363636, 0.208333333333333, "Black", 0.594942206400108,
+ 0.863636363636364, 0.722222222222222, 0.8125, 0.45, 16, 0.791666666666667,
+ 1, 0.8, 0.802083333333333, 0.826086956521739, 0.136363636363636,
+ 0.208333333333333, 0.277777777777778, 0.1875, "Red", 0.594942206400108,
+ 0.722222222222222, 0.863636363636364, 0.791666666666667, 0.55,
+ 24, 0.8125, 1.72727272727273, 0.8, 0.802083333333333, 0.80153452685422,
+ 0.207070707070707, 0.197916666666667, 0.207070707070707, 0.197916666666667,
+ "Average / Total", 0.594942206400108, 0.792929292929293, 0.807070707070707,
+ 0.8, 1, 40, 0.802083333333333, 1.36363636363636))
+
+})
+
diff --git a/tests/testthat/test-example-studentGrades.R b/tests/testthat/test-example-studentGrades.R
new file mode 100644
index 00000000..1010e08c
--- /dev/null
+++ b/tests/testthat/test-example-studentGrades.R
@@ -0,0 +1,32 @@
+context("Example: studentGrades")
+
+# This test file was auto-generated from a JASP example file.
+# The JASP file is stored in the module's examples/ folder.
+
+test_that("mlRegressionBoosting results match", {
+
+ # Load from JASP example file
+ jaspFile <- testthat::test_path("..", "..", "examples", "studentGrades.jasp")
+ opts <- jaspTools::analysisOptions(jaspFile)
+ dataset <- jaspTools::extractDatasetFromJASPFile(jaspFile)
+
+ # Encode and run analysis
+ encoded <- jaspTools:::encodeOptionsAndDataset(opts, dataset)
+ set.seed(1)
+ results <- jaspTools::runAnalysis("mlRegressionBoosting", encoded$dataset, encoded$options, encodedDataset = TRUE)
+
+ plotName <- results[["results"]][["plotDataSplit"]][["data"]]
+ testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
+ jaspTools::expect_equal_plots(testPlot, "analysis-1_figure-1_data-split")
+
+ plotName <- results[["results"]][["predictedPerformancePlot"]][["data"]]
+ testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
+ jaspTools::expect_equal_plots(testPlot, "analysis-1_figure-2_predictive-performance-plot")
+
+ table <- results[["results"]][["regressionTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list("Gaussian", 79, 252, 64, 0.1, 16.172076265739, 19, 21.0925224543305
+ ))
+
+})
+
diff --git a/tests/testthat/test-example-telcoCustomerChurn.R b/tests/testthat/test-example-telcoCustomerChurn.R
new file mode 100644
index 00000000..a1b1830b
--- /dev/null
+++ b/tests/testthat/test-example-telcoCustomerChurn.R
@@ -0,0 +1,22 @@
+context("Example: telcoCustomerChurn")
+
+# This test file was auto-generated from a JASP example file.
+# The JASP file is stored in the module's examples/ folder.
+
+test_that("mlClassificationKnn results match", {
+
+ # Load from JASP example file
+ jaspFile <- testthat::test_path("..", "..", "examples", "telcoCustomerChurn.jasp")
+ opts <- jaspTools::analysisOptions(jaspFile)
+ dataset <- jaspTools::extractDatasetFromJASPFile(jaspFile)
+
+ # Encode and run analysis
+ encoded <- jaspTools:::encodeOptionsAndDataset(opts, dataset)
+ set.seed(1)
+ results <- jaspTools::runAnalysis("mlClassificationKnn", encoded$dataset, encoded$options, encodedDataset = TRUE)
+
+ # Basic check - analysis runs without error
+ expect_false(isTRUE(results[["status"]] == "error"),
+ info = results[["results"]][["error"]])
+})
+
diff --git a/tests/testthat/test-example-wine.R b/tests/testthat/test-example-wine.R
new file mode 100644
index 00000000..61c48bd1
--- /dev/null
+++ b/tests/testthat/test-example-wine.R
@@ -0,0 +1,48 @@
+context("Example: wine")
+
+# This test file was auto-generated from a JASP example file.
+# The JASP file is stored in the module's examples/ folder.
+
+test_that("mlClusteringRandomForest results match", {
+
+ # Load from JASP example file
+ jaspFile <- testthat::test_path("..", "..", "examples", "wine.jasp")
+ opts <- jaspTools::analysisOptions(jaspFile)
+ dataset <- jaspTools::extractDatasetFromJASPFile(jaspFile)
+
+ # Encode and run analysis
+ encoded <- jaspTools:::encodeOptionsAndDataset(opts, dataset)
+ set.seed(1)
+ results <- jaspTools::runAnalysis("mlClusteringRandomForest", encoded$dataset, encoded$options, encodedDataset = TRUE)
+
+ table <- results[["results"]][["clusterInfoTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(1, 0.199425939703478, 0.411069251367668, 57, 267.166873258102,
+ 2, 0.612907360221033, 0.0747428309831974, 76, 821.0995183004,
+ 3, 0.187666700075488, 0.39282044191035, 45, 251.413259219857
+ ))
+
+ table <- results[["results"]][["clusteringTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(0.26, 1417.68, 1541.77, 3, 0.417783724129353, 178))
+
+ table <- results[["results"]][["importanceTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(20.3865617163522, "jaspColumn7", 16.7221375429735, "jaspColumn12",
+ 16.5937155443686, "jaspColumn6", 15.1922351110861, "jaspColumn13",
+ 14.7701748175345, "jaspColumn10", 13.763257093803, "jaspColumn9",
+ 13.6109822805815, "jaspColumn11", 13.4924520858126, "jaspColumn1",
+ 12.0407649461782, "jaspColumn2", 10.9165824200026, "jaspColumn4",
+ 10.6695338188, "jaspColumn8", 9.6982366053581, "jaspColumn5",
+ 9.64091096096958, "jaspColumn3"))
+
+ plotName <- results[["results"]][["optimPlot"]][["data"]]
+ testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
+ jaspTools::expect_equal_plots(testPlot, "analysis-1_figure-1_elbow-method-plot")
+
+ plotName <- results[["results"]][["plot2dCluster"]][["data"]]
+ testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
+ jaspTools::expect_equal_plots(testPlot, "analysis-1_figure-2_t-sne-cluster-plot")
+
+})
+