You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have just started using data.tree, and I was wanting to make a multi-rooted tree. With a quick look, it doesn't seem like multiple roots are supported (that is a reasonable design decision), so I decided to make an NA-like node. Specifically, I made a node with
data.tree::Node$new(NA_character_)
to be the fake root, and I put all the intended roots under that so that they could represent the multiple trees.
When I used FindNode() on it, an error occurred due to a missing value. That makes sense that NA names would not be supported, but I think it would help to either modify the code to support NA names or to make it an error to create an NA name.
As an aside, I also tried to make a fake root with data.tree::Node$new(NULL), and that gave an error as well.
library(data.tree)
root<-data.tree::Node$new(NA_character_)
FindNode(root, "foo")
#> Error in if (length(filterFun) == 0 || filterFun(node)) {: missing value where TRUE/FALSE needed
Hey Bill, thx for this! I think both would work for me, but I slightly prefer the first solution, i.e. "Ensure that the name is a non-NA char scalar" (one can always use an empty string "" as a workaround for a dummy node).
Yes, I would be more than thankful for a PR!
Thank you for the package!
I have just started using
data.tree
, and I was wanting to make a multi-rooted tree. With a quick look, it doesn't seem like multiple roots are supported (that is a reasonable design decision), so I decided to make an NA-like node. Specifically, I made a node withdata.tree::Node$new(NA_character_)
to be the fake root, and I put all the intended roots under that so that they could represent the multiple trees.
When I used
FindNode()
on it, an error occurred due to a missing value. That makes sense that NA names would not be supported, but I think it would help to either modify the code to supportNA
names or to make it an error to create anNA
name.As an aside, I also tried to make a fake root with
data.tree::Node$new(NULL)
, and that gave an error as well.Created on 2021-01-08 by the reprex package (v0.3.0)
If interested, I'd be happy to try to make a PR to do one of the following:
NA_character_
(while ensuring that it is a character scalar).The text was updated successfully, but these errors were encountered: