Skip to content

Commit

Permalink
Fix get_root_nodes() to handle grouped_df
Browse files Browse the repository at this point in the history
  • Loading branch information
UchidaMizuki committed Aug 4, 2024
1 parent 91652d7 commit 60aac79
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ get_root_nodes <- function(x) {
nodes <- get_nodes(x)
root_nodes <- tibble::tibble(drop_node(roots),
vec_slice(nodes, x$roots$.))
dplyr::new_grouped_df(root_nodes, dplyr::group_data(x$roots))
if (dplyr::is_grouped_df(x$roots)) {
root_nodes <- dplyr::new_grouped_df(root_nodes, dplyr::group_data(x$roots))
}
root_nodes
}

get_parent_node_ids <- function(x) {
Expand Down

0 comments on commit 60aac79

Please sign in to comment.