Extract tip labels from the object of class "phylo" or "multiPhylo"
Usage
tips(x, ...)
# S3 method for phylo
tips(x, ...)
# S3 method for multiPhylo
tips(x, all = FALSE, ...)
Arguments
- x
an object of class "phylo" or "multiPhylo"
- ...
arguments to be passed to methods
- all
optional extract tips for all trees, only if
x
is "multiPhylo"
Details
This is convenience method, it's purpose is to easily retrieve tip labels of a tree or
a collection of trees with the same tip labels. Due to this, when called on a collection of
trees (an object of class "multiPhylo"), only the first tree of a collection is accessed.
To obtain tip labels from all trees, specify the argument all=TRUE
.
Examples
tree = rankedPhylo(5)
tips(tree)
#> [1] "t1" "t2" "t3" "t4" "t5"
trees = rankedPhylo(3:7)
# only the first tree is accessed
tips(trees)
#> [1] "t1" "t2" "t3"
# use this to obtain all tip labels
tips(trees, all=TRUE)
#> [[1]]
#> [1] "t1" "t2" "t3"
#>
#> [[2]]
#> [1] "t1" "t2" "t3" "t4"
#>
#> [[3]]
#> [1] "t1" "t2" "t3" "t4" "t5"
#>
#> [[4]]
#> [1] "t1" "t2" "t3" "t4" "t5" "t6"
#>
#> [[5]]
#> [1] "t1" "t2" "t3" "t4" "t5" "t6" "t7"
#>