Questions tagged [data.tree]

23 questions
4
votes
1 answer

How to prune duplicate nodes to nearest common ancestor? data.tree R

I have an organisational structure expressed as a tree. library(data.tree) library(dplyr) df <- data.frame( from = c( 'BIG CORP Inc.', 'BIG CORP Inc.', 'BIG CORP Inc.', 'ABC Inc.', 'ABC Inc.', …
Alex Bădoi
  • 830
  • 2
  • 9
  • 24
3
votes
1 answer

Why shiny can not detect the `data.tree` manipulations outside of an `observe`?

Does Shiny can detect only common R’s objects? If yes, What objects can it observe? For example, I tried many options with no success to detect a data.tree changes in shiny. Does anyone know why this…
Iman
  • 2,224
  • 15
  • 35
2
votes
1 answer

Using R data.tree from within a Shiny app

I am trying to add some code to an existing shiny app that would display the graphic version of a data.tree structure. The code below successfully creates the data.tree the way I would like it displayed within a window in my shiny app. However, I…
Mikey
  • 43
  • 3
2
votes
1 answer

How to change node shapes and labels of a data.tree in a shiny app

First post so hopefully I've remembered to include everything and have used the right terminology! A while ago I used data.tree to create a diagram showing the relationships between animals in a herd. The diagram includes info in addition to the…
2
votes
1 answer

Adding a "fill" attribute to a data.tree object for use in collapsibleTree in R

We've been using dataframes with collapsibleTree() to make interactive, nice looking dendograms of hierarchical systems. The issue we have though is that it's difficult to get the customization we want when using a dataframe and it seems from the…
Ben G
  • 4,148
  • 2
  • 22
  • 42
1
vote
1 answer

How to detect and remove recursive structure in hierarchical data in R?

here is an example data like mine. Think of it as a dataset of user activity on a website. time from to t0 A a t1 a b t2 a c t3 a d t4 b x1 t5 b x2 t6 c y1 t7 x1 a I want to generate hierarchical data. But like last row in…
gokhan can
  • 189
  • 9
1
vote
1 answer

Label Position When Drawing Using data,tree Trees

My current code plots a decision tree with labels displayed on the right side of the arrows. However, I want the True label to go on the left side. How does one achieve this? library(data.tree) tree <- Node$new("Are you happy?") leaf1 <-…
shsh
  • 684
  • 1
  • 7
  • 18
1
vote
0 answers

How to get lists of descendant tip names of a data.tree object recursively?

I'm using the data.tree package in R and I have a tree like the one below, where only the leaf nodes have labels. I am trying to assign attributes that are lists of the descendants (we can assume the tree is always bifurcating). tree <-…
1
vote
1 answer

How do I visualize a data.tree with values in R?

As mentioned in title, how do I plot a data.tree with its relevant values? Thank you in advance for the help. Already at my wits end :( Edit: More information: The data I am trying to visualize is a survey, which the respondent is asked the primary…
FranzLich
  • 25
  • 5
0
votes
2 answers

Backconvert tree to data frame structure by keeping original rows

Let's assume the following data: x <- structure(list(parent = c("Acme Inc.", "Acme Inc.", "Acme Inc.", "Accounting", "Accounting", "Research", "Research", "IT", "IT", "IT"), child = c("Accounting", "Research", "IT", "New Software", "New…
deschen
  • 10,012
  • 3
  • 27
  • 50
0
votes
0 answers

Is there an easy way to transform data.tree Node objects in a format suitable for echarts4r functions?

According to echarts4r::e_sunburst help page you can use either "json list hierarchical data representation" which seem to be simply a list or a "tibble hierarchical data representation". The data.tree::ToListExplicit function seems to be able to…
Gilles San Martin
  • 4,224
  • 1
  • 18
  • 31
0
votes
1 answer

Use variable in place of sequential arguments in a function

I'm working with the data.trees package and the syntax to work with multiple attributes is to input them in quotes as arguments to a function, like here with print(): print(tree,"item1","item2","item99"). I want to be able to replace that sequence…
D3SL
  • 117
  • 8
0
votes
1 answer

Plot data.tree, How to customize

I would like to customize my data.tree. The problem is that I would need an arrow from each node to show me my "Salary" in order. It would be exactly the format you get when you type print(data.tree) . To explain: Chef <- Node$new("Chef") Chef2 <-…
0
votes
1 answer

Tree structure with data.tree in R: NAs

I am trying to develop a tree structure in R using data.tree . I am really new in using tree structures. Specifically, I have been following the tutorial: https://cran.r-project.org/web/packages/data.tree/vignettes/data.tree.html#trees-in-data.tree.…
Anna
  • 177
  • 13
0
votes
1 answer

Plot two data.tree objects side by side

I am using the data.tree package to create some trees. library(data.tree) library(DiagrammeR) acme <- Node$new("Acme Inc.") accounting <- acme$AddChild("Accounting") software <- accounting$AddChild("New Software") standards <-…
User2321
  • 2,952
  • 23
  • 46
1
2