r - Collapsible Tree example not working -
i read manual, , tried reproduce following example. r produces error:
error in collapsibletree(tree, tooltip = true, attribute = "value", aggfun = identity) : df must data frame
my question what's wrong piece of code. using r version 3.4.1. thanks!
# using flat relationship-style data frame 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 0 tree$value <- 0 # create tree diagram aggregation function of identity collapsibletree(tree, tooltip=true, attribute="value", aggfun=identity)
i added requires , ran code, no errors, follows:
require(data.tree) require(collapsibletree) 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") tree$value <- 0 collapsibletree(tree, tooltip=true, attribute="value", aggfun=identity)
here result:
is not hoped for?
Comments
Post a Comment