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 <- Chef$AddChild("Chef2")
Manager1 <- Chef2$AddChild("Manager1")
Manager2 <- Chef2$AddChild("Manager2")
Manager3 <- Chef2$AddChild("Manager3")
employee1 <- Manager1$AddChild("employee1")
employee2 <- Manager1$AddChild("employee2")
employee3 <- Manager2$AddChild("employee3")
employee4 <- Manager2$AddChild("employee4")
employee5 <- Manager2$AddChild("employee5")
employee6 <- Manager3$AddChild("employee6")
employee7 <- Manager3$AddChild("employee7")
employee8 <- Manager3$AddChild("employee8")
Salary <- c("100000", "50000", "25000", "25000", "3000", "90000", "20000", "1000", "10000", "5000", "1500", "5000", "3000")
Chef <- ToDataFrameTree(Chef, "pathString")
Chef <- as.data.frame(Chef)
Chef$Salary <- Salary
Chef <- as.Node(Chef)
print(Chef, "Salary")
plot(Chef)
It would be great if I can viusalize it so that it it looks like this:
However I only manage something like this...
I know it's a bit complicated described, but if anyone can help, I would appreciate it.
As you tagged your question with
diagrammer
, one option is to use Mermaid.js.1. Open Mermaid Live Editor
Mermaid allows even non-programmers to easily create detailed and diagrams through the Mermaid Live Editor.
2. Basic structure
In the </>code section, enter:
3. Review the basic graph
You will see a graph on the right-hand side of the editor (as below).
4. Modify to get the desired graph
Add wage label to each person, clear the </>code section, and enter the new code below:
You will see an updated graph on the right-hand side of the editor (as below).
5. Download the preferred graph
If you are happy with it, choose the preferred format and download the graph.