New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Building a tree from a two columns data frame #63
Comments
This function should do the trick:
Full Shiny Example:
|
Thanks for your reply. The result is the following in my hands. There are 3 extra nodes at the top, and the result is not exactly indented as I am expecting. Here is what I would like (Gimp edition). I am stuck on the nested structure. BTW I notice that I introduced an error in the example as Project B is repeated incorrectly. Please do find the correct example.
|
sry my bad, if you remove you get the tree I intended. Apparently preallocating a list was no good idea. ;) That still doesnt give you the tree you want, but with your new example, theres no easy logic to build the tree you want. If you can transform your data.frame to this for example it would be much easier to build a function and it would make more sense. NOTE: I included Study C-A for Project C. If you really want it blank, you will have to fill it with "" for example and filter that out in the loop.
Then the function would be quite similar:
|
Thanks for the update. Really helpful. I will work on that this evening. |
If you want a more general approach, where "Project-C" can be an empty node and that works with multiple "root"-nodes you could use this approach:
|
Thanks for your reply. In fact, I want the inverse transformation of the get_FlatList function, without any constraint. Here is how I exploit this function to get a data.frame view of the tree. This allows me to link the tree to some other information. Related to question #64, I would to use this data.frame structure to update the tree presented by shinyTree.
|
May I ask why you use :::: instead of :: and why there is no documentation help for this function? |
The function You can still access the internal package functions with |
This function works in my hand. |
Is it possible, to use the saved result of get_Flatlist to restore the selections of a tree by means of R scripting? |
It is not possible with R only, but with some JavaScript it would be. |
Hi,
I would like to build a tree from a data frame that looks like the following one. Is there a function or a piece of code? I would prefer not using a lot of dependencies. I already looked at ape and igraph, but didn't find my way. Any help is welcome.
The text was updated successfully, but these errors were encountered: