我阅读了手册,并尝试重现以下示例。但是R会产生错误:
collapsibleTree中的错误(树,工具提示= TRUE,属性="值",aggFun =身份):df必须是数据框
我的问题是这段代码有什么问题。我使用的是R版本3.4.1。谢谢!
# Using a flat relationship-style data frame with tooltips
Relationships <- data.frame(
Parent = c(".",".","A", "A", "A", "B", "B", "C", "E", "E", "F", "K", "K", "M", "M"),
Child = c("A","K","B", "C", "D", "E", "F", "G", "H", "I", "J", "L", "M", "N", "O"),
Value = 1:15
)
tree <- data.tree::FromDataFrameNetwork(Relationships, "Value")
# Define root node value as 0
tree$Value <- 0
# Create tree diagram with the aggregation function of identity
collapsibleTree(tree, tooltip=TRUE, attribute="Value", aggFun=identity)