Hi I'm trying to reorder all of the trees in a multiphylo object which should just be a form of applying a function over a list, which I have done before. However, I can't seem to get the 'reorder' command from the package APE to work with lapply nor treeapply across a multiphylo object. My function does run across the multiphylo object with lapply but does not actually reorder the trees. It seems to just return the original, unordered trees. Any help would be much appreciated!
Example of my code
Edit: It also doesn't seem to just be my data, I've added a line of code to simulate 100 trees and the function also does not reorder the simulated trees properly.
#I normally read my multiphylo object in from a file, but simulate one
#here as an example
#trees<-read.trees("multiphyloobject.tre")
#Simulate 100 trees
trees<-pbtree(n=100,scale=10,nsim=100)
myfun <- function(x) {
reorder(x,order="pruningwise")}
ordtrees<-lapply(trees,myfun)