Hi Chris.

The first problem here is that your vector includes NAs.

You just need to do:

mean(x,na.rm=TRUE)
## or
mean(x[!is.na(x)])

For the second part of your question, you might look at prop.part/prop.clades in ape or matchNodes in phytools. These functions can be used to ask if particular edges/clades/nodes, defined by bypartitions or descendant taxa, found in one tree are present in others.

All the best, Liam

Liam J. Revell, Associate Professor of Biology
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
email: [email protected]
blog: http://blog.phytools.org

On 10/10/2015 4:48 PM, Chris Buddenhagen wrote:
Dear all

My goal is to read in 352 or more trees and get out mean and sd support
values for each. Ideally i read in all 352 trees (or reference files in in
folder) and the function returns a list of support values with sd for each
tree.

For now I am having problems getting the support values to be treated as
numbers. Can anyone help?

I tried this on a single tree.


#read in tree and calculate mean and sd
tr<-read.tree(file.choose())#bipartout.tree
tr_sd <- sd(as.numeric(tr$node.label))
tr_mean <- mean(as.numeric(tr$node.label))
tr_sd
[1] NA
tr_mean
tr_mean
[1] NA
#check numbers are OK
are_numbers<-as.numeric(tr$node.label)
are_numbers
  [1]  NA  NA  86  97  58  40  88 100  18   7   7   2   1   4  25  38   1
3  62   1  52  82   1   1   7   8
[27]  64  96  48  32  40  61  72  49  61  67  32  52  54  41  36  93  97
92  70  75  12   9   5  83 100  38
[53]  21  83  70  65  43  66  70  73  91 100  82  88  97  83  88  37  23
99  62  26  87   0   0   1  14  15
[79]  21  62  28  55  76  73  94
#so doesn't this look OK
mean(are_numbers)
[1] NA

#Not sure why its not calculating. What is going on here?

Another question: is there a way to use a reference total evidence tree and
get an idea how many gene trees support the same descendants (tip members)
for a node? Then maybe do the same and take into account that not all gene
trees have the same tips? Perhaps pruning the total evidence tree to the
shared taxa in the gene trees?

Hopefully


Chris Buddenhagen
[email protected]

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-phylo mailing list - [email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/[email protected]/


_______________________________________________
R-sig-phylo mailing list - [email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/[email protected]/

Reply via email to