diff --git a/DESCRIPTION b/DESCRIPTION index 3de6d53..7fe1a5d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -27,5 +27,5 @@ Remotes: Displayr/flipData, Displayr/flipU, Displayr/rhtmlSankeyTree, Displayr/verbs -RoxygenNote: 7.1.1 +RoxygenNote: 7.1.2 Encoding: UTF-8 diff --git a/R/cart.R b/R/cart.R index 3124279..3862c79 100644 --- a/R/cart.R +++ b/R/cart.R @@ -396,7 +396,7 @@ print.CART <- function(x, ...) if (x$output == "Sankey") { frame <- rPartToTreeFrame(x) - tree.list <- treeFrameToList(frame, attr(x, "xlevels"), x$model, x$where, x$labels) + tree.list <- treeFrameToList(frame, attr(x, "xlevels"), x$model, x$where, x$labels, ...) plt <- SankeyTree(tree.list, value = "n", nodeHeight = 100, numeric.distribution = TRUE, tooltip = "tooltip", treeColors = TRUE, terminalDescription = TRUE) print(plt) diff --git a/R/sankey.R b/R/sankey.R index 24fdb74..3627f05 100644 --- a/R/sankey.R +++ b/R/sankey.R @@ -112,6 +112,9 @@ treeFrameToList <- function(frame, xlevels, model, assigned, labels, max.tooltip }) } + if (length(custom.color) == 0L) + custom.color <- formals()[["custom.color"]] + if (outcome.is.factor) { # Classification tree. tree.type = "Classification" diff --git a/tests/testthat/test-CART.R b/tests/testthat/test-CART.R index 2e78e11..e63b864 100644 --- a/tests/testthat/test-CART.R +++ b/tests/testthat/test-CART.R @@ -19,6 +19,8 @@ test_that("saving variables", data = bank, subset = bank$ID > 100)) expect_error(predict(z), NA) expect_error(flipData::Probabilities(z), NA) + expect_error(print(z), NA) + expect_error(print(z, custom.color = NULL), NA) })