Re: [R-sig-phylo] Count the number of character/state changes in a tree

2015-03-03 Thread f.k...@mailbox.org
Hi Luiz, didn’t try that out, but here is some code I wrote for some of the megaphylogenies I produced where you don’t want to search in a pdf or so where the transitions are… It’s two months ago so don’t know if it was totally save I think you should make sure the order of the tree and

[R-sig-phylo] Count the number of character/state changes in a tree

2015-03-03 Thread Luiz Max Carvalho
Dear Phylofolks, Suppose I have a phylo object phy and the states at all nodes (internal and external). Would the following function give me the number of state changes? get.changes - function(tree, states){ sum(apply(phy$edge, 1, function(x) states[x[1]]!=states[x[2]])) } If not, what

Re: [R-sig-phylo] Count the number of character/state changes in a tree

2015-03-03 Thread Liam J. Revell
If the vector states is indexed by the node numbers of phy$edge, then the following seems like it should work: get.changes-function(tree,states) sum(apply(tree$edge,1,function(x,s) s[x[1]]!=s[x[2]],s=states)) This will of course only be the minimum number of changes given your states at

[R-sig-phylo] Stuck with Phylomatic tree!

2015-03-03 Thread Alexandre F. Souza
Dear friends, I am trying to adjust the leghts of a tree I created using 113 tree species in Phylomatic using the bladj function in Phylocom. Unfortunately, the program crashes when I use the tree without the final note about the impossibility of matching four of the species (when I exclude