Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@cparsania

Description

@cparsania

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')"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions