Skip to content
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

using the dplyr::mutate on tbl_tree convert it to tbl_df #7

Closed
cparsania opened this issue Jul 31, 2018 · 1 comment
Closed

using the dplyr::mutate on tbl_tree convert it to tbl_df #7

cparsania opened this issue Jul 31, 2018 · 1 comment

Comments

@cparsania
Copy link

Hi, applying mutate on tbl_tree remains no longer tbl_tree object . And therefore, cannot convert back to tree using as.phylo(). See the example below

tree <- rtree(4)
tree
Phylogenetic tree with 4 tips and 3 internal nodes.

Tip labels:
[1] "t1" "t4" "t3" "t2"

Rooted; includes branch lengths.

as_data_frame(tree) %>% class()
[1] "tbl_tree"   "tbl_df"     "tbl"        "data.frame"

as_data_frame(tree)  %>% dplyr::mutate(row_number()) %>% class()
[1] "tbl_df"     "tbl"        "data.frame"

tree_data <- as_data_frame(tree)  %>% dplyr::mutate(row_number())

as.phylo(tree_data)
Error in UseMethod("as.phylo") : 
  no applicable method for 'as.phylo' applied to an object of class "c('tbl_df', 'tbl', 'data.frame')"
@cparsania cparsania changed the title using the dplyr::mutate on tbl_tree convert it to tbl_df using the dplyr::mutate on tbl_tree convert it to tbl_df Jul 31, 2018
@cparsania cparsania changed the title using the dplyr::mutate on tbl_tree convert it to tbl_df using the dplyr::mutate on tbl_tree convert it to tbl_df Jul 31, 2018
@GuangchuangYu
Copy link
Member

now a mutate method for tbl_tree was implemented, see 24e2b0a.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants