PCMTreeSetPartition.Rd
Set a partition of a tree by specifying the partition nodes
PCMTreeSetPartition(tree, nodes = c(PCMTreeNumTips(tree) + 1L), inplace = TRUE)
tree | a PCMTree object. |
---|---|
nodes | a character vector containing tip or node labels or an integer vector denoting tip or internal nodes in tree - the parts change at the start of the branches leading to these nodes. Default: c(PCMTreeNumTips(tree) + 1L). |
inplace | a logical indicating if the change should be done to the tree in the calling environment (TRUE) or a copy of the tree with set edge.part member should be returned (FALSE). Default is TRUE. |
If inplace is TRUE nothing, otherwise a copy of the tree with set edge.part member.
set.seed(1, kind = "Mersenne-Twister", normal.kind = "Inversion") tree <- PCMTree(ape::rtree(8)) PCMTreeSetLabels(tree, paste0("x", PCMTreeGetLabels(tree))) PCMTreeGetPartition(tree)#> x9 #> 9PCMTreeGetPartNames(tree)#> [1] "x9"PCMTreeGetPartRegimes(tree)#> x9 #> 1#> x9 x14 x12 #> 9 14 12PCMTreeGetPartNames(tree)#> [1] "x9" "x14" "x12"PCMTreeGetPartRegimes(tree)#> x9 x14 x12 #> 1 2 3# } # reset the partition to a default one, where there is only one part: PCMTreeSetPartition(tree) PCMTreeGetPartition(tree)#> x9 #> 9PCMTreeGetPartNames(tree)#> [1] "x9"PCMTreeGetPartRegimes(tree)#> x9 #> 1# } # reset the labels to the default labels which are character representations # of the node ids PCMTreeSetLabels(tree) PCMTreeGetPartition(tree)#> 9 #> 9PCMTreeGetPartNames(tree)#> [1] "9"PCMTreeGetPartRegimes(tree)#> 9 #> 1