From 3af02584c1f9745597b84ea17c0f15279fdc105c Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Sat, 2 Jul 2022 04:37:53 -0700 Subject: [PATCH] error early if missing DiagrammeR (#8037) --- R-package/R/xgb.plot.multi.trees.R | 3 +++ 1 file changed, 3 insertions(+) diff --git a/R-package/R/xgb.plot.multi.trees.R b/R-package/R/xgb.plot.multi.trees.R index 063f1034a..fc54d777d 100644 --- a/R-package/R/xgb.plot.multi.trees.R +++ b/R-package/R/xgb.plot.multi.trees.R @@ -62,6 +62,9 @@ #' @export xgb.plot.multi.trees <- function(model, feature_names = NULL, features_keep = 5, plot_width = NULL, plot_height = NULL, render = TRUE, ...){ + if (!requireNamespace("DiagrammeR", quietly = TRUE)) { + stop("DiagrammeR is required for xgb.plot.multi.trees") + } check.deprecation(...) tree.matrix <- xgb.model.dt.tree(feature_names = feature_names, model = model)