[R] Fix warning from DT about mismatched names (#10743)

This commit is contained in:
david-cortes 2024-09-28 23:52:15 +02:00 committed by GitHub
parent c9f89c4241
commit 429f956111
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -109,11 +109,10 @@ xgb.plot.multi.trees <- function(model, features_keep = 5, plot_width = NULL, pl
edges.dt <- data.table::rbindlist( edges.dt <- data.table::rbindlist(
l = list( l = list(
tree.matrix[Feature != "Leaf", .(abs.node.position, Yes)], tree.matrix[Feature != "Leaf", .(From = abs.node.position, To = Yes)],
tree.matrix[Feature != "Leaf", .(abs.node.position, No)] tree.matrix[Feature != "Leaf", .(From = abs.node.position, To = No)]
) )
) )
data.table::setnames(edges.dt, c("From", "To"))
edges.dt <- edges.dt[, .N, .(From, To)] edges.dt <- edges.dt[, .N, .(From, To)]
edges.dt[, N := NULL] edges.dt[, N := NULL]