Closed acpaulo closed 1 year ago
You should use the ape library to manipulate phylo objects. It is a dependency of treeio so should already have it installed. ape's keep.tip
function subsets tips.
library(ape)
tree.2018.subset <- keep.tip(tree.2018, grep("PT", tree.2018$tip.label))
Note that keep.tip
uses tip/node numbers not a boolean filter so you need to use grep
instead of grepl
.
Thank you Brad, it did solve the problem.
Describe you issue
Is there a way to subset the nwk file without transform it to a data.frame or to pass a data.fram to a phylo object again ?
Thank you in advance