Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFix a bug in child() #8
Conversation
The old version fails when .data$label contains numeric characters like '4'
because isTRUE('4' == 4) in R, and it causes superfluous match.
Now .node argument must be always numeric and compared with .data$parent.
|
the original version supports passing |
|
Good catch, and sorry, I should have mentioned it more explicitly. But 0df361c seems still unsafe to me because it allows comparison between numerics and characters (character child.tbl_tree <- function(.data, .node, ...) {
valid.tbl_tree(.data)
if (is.character(.node)) {
.node <- .data$node[.data$label == .node]
}
.data[.data$parent == .node & .data$parent != .data$node,]
}
|
|
thanks and incorporated. |
|
Why do you leave these lines? And the effect of this part is also doubtful: So my suggestion is... in my previous comment #8 (comment). |
|
oops, my fault. just incorporated. |
The old version fails when
.data$labelcontains numeric characters like'6'because
isTRUE('6' == 6)in R, and it causes superfluous match.Now
.nodeargument must be always numeric and compared with.data$parent.Output from the current version:
Output from the fixed version: