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:

enter image description here

is not hoped for?


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -