[Picante-commits] r201 - in branches/will: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Nov 19 01:54:22 CET 2009


Author: will_cornwell
Date: 2009-11-19 01:54:22 +0100 (Thu, 19 Nov 2009)
New Revision: 201

Added:
   branches/will/R/tax.distinctiveness.R
   branches/will/man/tax.distinctiveness.Rd
Modified:
   branches/will/DESCRIPTION
   branches/will/man/evol.distinct.Rd
Log:
added taxonomic distinctiveness function

Modified: branches/will/DESCRIPTION
===================================================================
--- branches/will/DESCRIPTION	2009-11-19 00:37:08 UTC (rev 200)
+++ branches/will/DESCRIPTION	2009-11-19 00:54:22 UTC (rev 201)
@@ -3,7 +3,7 @@
 Title: R tools for integrating phylogenies and ecology
 Version: 0.6-1
 Date: 2009-3-18
-Author: Steven Kembel <skembel at uoregon.edu>, David Ackerly <dackerly at berkeley.edu>, Simon Blomberg <s.blomberg1 at uq.edu.au>, Peter Cowan <pdc at berkeley.edu>, Matthew Helmus <mrhelmus at wisc.edu>, Helene Morlon  <morlon.helene at gmail.com>, Campbell Webb <cwebb at oeb.harvard.edu>
+Author: Steven Kembel <skembel at uoregon.edu>, David Ackerly <dackerly at berkeley.edu>, Simon Blomberg <s.blomberg1 at uq.edu.au>, Peter Cowan <pdc at berkeley.edu>, Matthew Helmus <mrhelmus at wisc.edu>, Helene Morlon  <morlon.helene at gmail.com>, Campbell Webb <cwebb at oeb.harvard.edu>, Will Cornwell <wcornwell at zoology.ubc.ca>
 Maintainer: Steven Kembel <skembel at uoregon.edu>
 Depends: ape, vegan, nlme, geiger
 Suggests: brglm, circular

Added: branches/will/R/tax.distinctiveness.R
===================================================================
--- branches/will/R/tax.distinctiveness.R	                        (rev 0)
+++ branches/will/R/tax.distinctiveness.R	2009-11-19 00:54:22 UTC (rev 201)
@@ -0,0 +1,28 @@
+#Taxic diversity: Vane-Wright et al., 1991 and May 1990 which accounts for polytomies by counting the number of branches descending from each node that lies on the path from a spp tip to the root (not just counting the number of nodes.
+
+tax.distinctiveness<- function(tree, type=c("Vane-Wright", "May")){
+
+if(is.rooted(tree)==FALSE)
+warning("A rooted phylogeny is required for meaningful output of this function", call.=FALSE)
+
+n.nodes<- switch(type, "Vane-Wright"=node.number(tree),
+	"May"={edge<- tree$edge
+
+	for(i in 1:length(tree$tip.label)){
+	spp<- tree$tip.label[i]
+	nodes<- get.nodes(tree, spp)
+	n.branch<- nrow(edge[edge[,1] %in% nodes,])
+	if(i==1)
+		n.branch.all<- n.branch else
+		n.branch.all<- c(n.branch.all, n.branch)}
+	n.nodes<- cbind(tree$tip.label, as.data.frame(n.branch.all))
+		})
+
+	w<- as.data.frame(1/n.nodes[,2])/sum(1/n.nodes[,2])
+	results<- cbind(tree$tip.label, w)
+	names(results)<- c("Species", "w")
+	results
+}
+
+
+

Modified: branches/will/man/evol.distinct.Rd
===================================================================
--- branches/will/man/evol.distinct.Rd	2009-11-19 00:37:08 UTC (rev 200)
+++ branches/will/man/evol.distinct.Rd	2009-11-19 00:54:22 UTC (rev 201)
@@ -32,6 +32,9 @@
 
 Isaac, N.J.B., Turvey, S.T., Collen, B., Waterman, C. and Baillie, J.E.M. (2007). Mammals on
 the EDGE: conservation priorities based on threat and phylogeny. PLoS ONE, 2, e296.
+
+Mark Vellend, William K. Cornwell, Karen Magnuson-Ford, and Arne ¯. Mooers. Measuring phylogenetic biodiversity
+In: Biological diversity: frontiers in measurement and assessment.  Edited by Anne Magurran & Brian McGill. in press
 }
 \author{
 Karen Magnuson-Ford 

Added: branches/will/man/tax.distinctiveness.Rd
===================================================================
--- branches/will/man/tax.distinctiveness.Rd	                        (rev 0)
+++ branches/will/man/tax.distinctiveness.Rd	2009-11-19 00:54:22 UTC (rev 201)
@@ -0,0 +1,78 @@
+\name{tax.distinctiveness}
+\Rdversion{1.1}
+\alias{tax.distinctiveness}
+%- Also NEED an '\alias' for EACH other topic documented here.
+\title{
+%%  ~~function to do ... ~~
+}
+\description{
+Taxic diversity: Vane-Wright et al., 1991 and May 1990 which accounts for polytomies by counting the number of branches descending from each node that lies on the path from a spp tip to the root (not just counting the number of nodes).
+}
+\usage{
+tax.distinctiveness(tree, type = c("Vane-Wright", "May"))
+}
+%- maybe also 'usage' for other objects documented here.
+\arguments{
+  \item{tree}{
+phylogeny in ape format
+}
+  \item{type}{
+specify "Vane-Wright" or "May"
+}
+
+
+\references{
+Vane-Wright, R.I., Humphries, C.J. and Williams, P.H. (1991). What to protect? Ð Systematics
+and the agony of choice. Biological Conservation, 55, 235-254.
+
+May, R.M. (1990). Taxonomy as destiny. Nature, 347, 129-130.
+
+Mark Vellend, William K. Cornwell, Karen Magnuson-Ford, and Arne ¯. Mooers. Measuring phylogenetic biodiversity
+In: Biological diversity: frontiers in measurement and assessment.
+Edited by Anne Magurran & Brian McGill. in press
+}
+\author{
+Karen Magnuson-Ford 
+Will Cornwell
+Arne Mooers
+Mark Vellend
+}
+
+
+%% ~Make other sections like Warning with \section{Warning }{....} ~
+
+
+\examples{
+##---- Should be DIRECTLY executable !! ----
+##-- ==>  Define data, use random,
+##--	or do  help(data=index)  for the standard data sets.
+
+## The function is currently defined as
+function(tree, type=c("Vane-Wright", "May")){
+
+if(is.rooted(tree)==FALSE)
+warning("A rooted phylogeny is required for meaningful output of this function", call.=FALSE)
+
+n.nodes<- switch(type, "Vane-Wright"=node.number(tree),
+	"May"={edge<- tree$edge
+
+	for(i in 1:length(tree$tip.label)){
+	spp<- tree$tip.label[i]
+	nodes<- get.nodes(tree, spp)
+	n.branch<- nrow(edge[edge[,1] \%in\% nodes,])
+	if(i==1)
+		n.branch.all<- n.branch else
+		n.branch.all<- c(n.branch.all, n.branch)}
+	n.nodes<- cbind(tree$tip.label, as.data.frame(n.branch.all))
+		})
+
+	w<- as.data.frame(1/n.nodes[,2])/sum(1/n.nodes[,2])
+	results<- cbind(tree$tip.label, w)
+	names(results)<- c("Species", "w")
+	results
+  }
+}
+% Add one or more standard keywords, see file 'KEYWORDS' in the
+% R documentation directory.
+\keyword{ ~kwd1 }
+\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line



More information about the Picante-commits mailing list