AdeelK93 / collapsibleTree

Create Interactive Collapsible Tree Diagrams in R using D3.js
https://adeelk93.github.io/collapsibleTree/
158 stars 41 forks source link

[question] same attributes displayed at the same level #63

Open tommasodelorenzo opened 2 years ago

tommasodelorenzo commented 2 years ago

If one has a three level structure as

df <- data.frame(
    l1 = c(
        "1","1","2","2"
    ),
    l2 = c(
        "11","12",NA,"21"
    ),
    l3 = c(
        "111", NA, "201", "211"
    )
)

where nodes of a given level have children belonging to different sub-level. When plotting a collapsibleTree here, the "201" node is displayed at the same level as "11", "12" and "21", even though it belongs to the the 3rd level. Is it possible to have it shown together with the other nodes of the 3rd level? That would look like (sorry for the hand drawing) tree I also tried re-structuring the dataframe to feed a collapsingTreeNetwork object with no-luck. Taking the example in the documentation my question can be phrased by saying that for instance "Erika" being a "scientist" should be displayed together with all the "scientist".