I am trying to run functions over multiple phylogenetic trees (files of class multiphylo). Most of these functions come with specific R packages, but are only applicable to single trees (class phylo). Essentially, multiphylo object consists of many objects of class phylo. I was trying to see if using a for lopp, I could run the same operation on all objects in the multiphylo object but I am running into errors. Any suggestions?
library(ape)
library(TreePar)
x=read.nexus(file.choose()) #read in file with multiple phylogenetic trees
times<-0
for(i in 1:length(x))
{
times[i]<-getx(x[[i]])
print(times[i])
}
print(i)
I get the following error warning -
In ages[i] = getx(x[[i]]) : number of items to replace is not a multiple of replacement length