From 996645dc17b7a46470f7c653de093db89467032d Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 Nov 2015 22:04:54 +0100 Subject: [PATCH] Change the way functions are called --- R-package/R/xgb.plot.tree.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R-package/R/xgb.plot.tree.R b/R-package/R/xgb.plot.tree.R index 475be7231..10ca42bc7 100644 --- a/R-package/R/xgb.plot.tree.R +++ b/R-package/R/xgb.plot.tree.R @@ -70,7 +70,7 @@ xgb.plot.tree <- function(feature_names = NULL, filename_dump = NULL, model = NU allTrees[, shape:= "rectangle"][Feature == "Leaf", shape:= "oval"] allTrees[, filledcolor:= "Beige"][Feature == "Leaf", filledcolor:= "Khaki"] - nodes <- create_nodes(nodes = allTrees[,ID], + nodes <- DiagrammeR::create_nodes(nodes = allTrees[,ID], label = allTrees[,label], #type = c("lower", "lower", "upper", "upper"), style = "filled", @@ -81,7 +81,7 @@ xgb.plot.tree <- function(feature_names = NULL, filename_dump = NULL, model = NU fontname = "Helvetica" ) - edges <- create_edges(from = allTrees[Feature != "Leaf", c(ID)] %>% rep(2), + edges <- DiagrammeR::create_edges(from = allTrees[Feature != "Leaf", c(ID)] %>% rep(2), to = allTrees[Feature != "Leaf", c(Yes, No)], label = allTrees[Feature != "Leaf", paste("<",Split)] %>% c(rep("",nrow(allTrees[Feature != "Leaf"]))), color = "DimGray", @@ -90,11 +90,11 @@ xgb.plot.tree <- function(feature_names = NULL, filename_dump = NULL, model = NU fontname = "Helvetica", rel = "leading_to") - graph <- create_graph(nodes_df = nodes, + graph <- DiagrammeR::create_graph(nodes_df = nodes, edges_df = edges, graph_attrs = "rankdir = LR") - render_graph(graph, width = width, height = height) + DiagrammeR::render_graph(graph, width = width, height = height) } # Avoid error messages during CRAN check.