Question: Drop tip from multiPhylo object in R
A multiPhylo object is basically just a list of phylo objects. These can be operated on using the standard approaches for working with lists, so we use
lapply to return a list for coercion back to the starting data type.
library(ape) one <- rlineage(1, 1) two <- rlineage(1, 1) combined <- c(one, two) # check: returns "multiPhylo" class(combined) results <- lapply(combined, drop.tip, "t2") # explicitly convert back to an object of class multiPhylo final <- do.call(c, results)