liamrevell / phytools

GNU General Public License v3.0
198 stars 56 forks source link

Error when using "as.multiPhylo" #120

Closed OttoHenning closed 1 year ago

OttoHenning commented 1 year ago

Hi Liam,

I'm trying to convert a tree-file (scenario.2 list of randomized trees, generated by "phylomaker") into "multiphylo-format" by using the "as.multiPhylo" command in order to ultimately run a phylogenetic linear regression with randomized trees. The following error is displayed:

"Error in UseMethod("as.multiPhylo") : no applicable method for 'as.multiPhylo' applied to an object of class "list"

However, on my supervisor's machine, the command works fine with the same data, same command and same version of R. The scenario.2 tree from the phylomaker is a "list object" on his PC too, but the as.multiPhylo conversion is completed without problems. We both have no idea, what might be the reason for the error.

If you have any idea what might be the problem, I'd be very thankful.

Best regards,

Henning

liamrevell commented 1 year ago

Dear @OttoHenning.

as.multiPhylo is not really supposed to work this way.

To make a "multiPhylo" object from a set of "phylo" objects, you can use the R generic method c( ). I.e.:

library(phytools)
t1<-rtree(n=10)
t2<-rtree(n=20)
tt<-c(t1,t2)
class(tt)

-- Liam