data.tree
data.tree copied to clipboard
as.Node.data.frame raises error when column name of data.frame equals the name of one node
Thank you so much for your very helpful R-package!
I encountered one issue: I get an error message (Error: $ operator is invalid for atomic vectors
) when converting the following data.frame to a data.tree:
x <- data.frame(
pathString = c( 'A', 'A/foo'),
foo = 'bar'
)
y <- as.Node(x)
The problem disappears when changing either the column name or the name of the node, thus I assume that the reason for the problem is that both the second node and the column of x
are named foo
:
x <- data.frame(
pathString = c('A', 'A/bar'),
foo = 'bar'
)
y <- as.Node(x)
y
... no problems ....
Moreover, everything works as expected when deleting the parent (root) node:
x <- data.frame(
pathString = c('A/foo'),
foo = 'bar'
)
y <- as.Node(x)
Do you have any ideas how to fix this?
Hey, sorry for the late reply, and thanks for this! Would you mind to create a pull request with your changes? Thx!