[Ecopd-commits] r43 - in pkg: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Oct 22 00:22:30 CEST 2009
Author: regetz
Date: 2009-10-22 00:22:30 +0200 (Thu, 22 Oct 2009)
New Revision: 43
Removed:
pkg/man/commPD.Rd
pkg/man/doByCommunity.Rd
pkg/man/getMinTL.Rd
pkg/man/print.ecophylo.Rd
pkg/man/weightByAbund.Rd
Modified:
pkg/R/pd.R
pkg/R/utilities.R
pkg/man/Families.Rd
pkg/man/LookupTL.Rd
pkg/man/Supertree.Rd
pkg/man/abundance.Rd
pkg/man/caterpillar.Rd
pkg/man/ecophylo.Rd
pkg/man/genera.Rd
pkg/man/minTL.Rd
pkg/man/pd.Rd
pkg/man/siteBySpecies.Rd
pkg/man/tipLength.Rd
Log:
cleaned up obvious problems in existing documentation files; modified
several functions to rename tree argument to 'phy', matching docs
Modified: pkg/R/pd.R
===================================================================
--- pkg/R/pd.R 2009-10-21 03:32:43 UTC (rev 42)
+++ pkg/R/pd.R 2009-10-21 22:22:30 UTC (rev 43)
@@ -1,11 +1,11 @@
# basic pd calculation
-pd <- function(tree) {
+pd <- function(phy) {
# exclude root edge from calculation (if it exists)
- if (isRooted(tree)) {
- nonroot.nodes <- setdiff(nodeId(tree), rootNode(tree))
- tot.length <- sum(edgeLength(tree, nonroot.nodes))
+ if (isRooted(phy)) {
+ nonroot.nodes <- setdiff(nodeId(phy), rootNode(phy))
+ tot.length <- sum(edgeLength(phy, nonroot.nodes))
} else {
- tot.length <- sum(edgeLength(tree))
+ tot.length <- sum(edgeLength(phy))
}
return(tot.length)
}
@@ -15,15 +15,10 @@
if (missing(genera)) stop("must supply vector of genera")
- lengthsTipToRoot <- function(tree) {
- # Workaround problem in phylobase -- need to figure out if this is
- # really the right thing to do...
- if (!is.na(tree at root.edge)) {
- warning("omitting root edge")
- is.na(tree at root.edge) <- TRUE
- }
- sapply(tipLabels(tree), function(x) {
- sumEdgeLength(tree, ancestors(tree, x, "ALL"))
+ lengthsTipToRoot <- function(x) {
+ root.node <- rootNode(x)
+ sapply(ancestors(x, nodeId(x, "tip"), "ALL"), function(n) {
+ sumEdgeLength(x, setdiff(n, root.node))
})
}
Modified: pkg/R/utilities.R
===================================================================
--- pkg/R/utilities.R 2009-10-21 03:32:43 UTC (rev 42)
+++ pkg/R/utilities.R 2009-10-21 22:22:30 UTC (rev 43)
@@ -55,50 +55,50 @@
}
# tip length extractor
-tipLength <- function(tree) {
- tip.length <- edgeLength(tree, nodeId(tree, type="tip"))
- names(tip.length) <- tipLabels(tree)
+tipLength <- function(phy) {
+ tip.length <- edgeLength(phy, nodeId(phy, type="tip"))
+ names(tip.length) <- tipLabels(phy)
return(tip.length)
}
# abundance extractor
-abundance <- function(tree) {
- abund <- tipData(tree)$abundance
- if (is.null(abund)) abund <- rep(NA_real_, nTips(tree))
- names(abund) <- row.names(tipData(tree))
+abundance <- function(phy) {
+ abund <- tipData(phy)$abundance
+ if (is.null(abund)) abund <- rep(NA_real_, nTips(phy))
+ names(abund) <- row.names(tipData(phy))
return(abund)
}
# abundance assignment function
-`abundance<-` <- function(tree, value) {
- tipData(tree)$abundance <- value
- return(tree)
+`abundance<-` <- function(phy, value) {
+ tipData(phy)$abundance <- value
+ return(phy)
}
# minTL extractor
-minTL <- function(tree) {
- minTL <- tdata(tree)$minTL
+minTL <- function(phy) {
+ minTL <- tdata(phy)$minTL
if (!is.null(minTL)) {
- names(minTL) <- row.names(tdata(tree))
+ names(minTL) <- row.names(tdata(phy))
}
return(minTL)
}
# minTL assignment function
-`minTL<-` <- function(tree, value) {
+`minTL<-` <- function(phy, value) {
# MAKE SURE THIS MATCHES WITH THE TAXA ORDER IN THE TREE!
if (!is.numeric(value)) {
stop("minTL values must be a numeric vector")
- } else if (length(value)!=nrow(tdata(tree))) {
+ } else if (length(value)!=nrow(tdata(phy))) {
stop("number of minTL values must equal number of species")
}
- tree at tip.data <- replace(tree at tip.data, "minTL", value)
- return(tree)
+ phy at tip.data <- replace(phy at tip.data, "minTL", value)
+ return(phy)
}
# genera extractor
-genera <- function(tree) {
+genera <- function(phy) {
#From taxa names in tree, remove "_" and species name after
- gsub("_.*$", "", tipLabels(tree))
+ gsub("_.*$", "", tipLabels(phy))
}
Modified: pkg/man/Families.Rd
===================================================================
--- pkg/man/Families.Rd 2009-10-21 03:32:43 UTC (rev 42)
+++ pkg/man/Families.Rd 2009-10-21 22:22:30 UTC (rev 43)
@@ -3,23 +3,17 @@
\docType{data}
\title{Plant family lookup vector}
\description{
-Built-in vector useful for determining the plant family for a particular
-plant genus.
+ Built-in vector useful for determining the plant family for a
+ particular plant genus.
}
\format{
-A named character vector matching 13,584 genus names with their
-respective families. Vector names are primarily genus names, although
-the 408 family names are also included for self-referential lookups.
+ A named character vector matching 13,584 genus names with their
+ respective families. Vector names are primarily genus names, although
+ the 408 family names are also included for self-referential lookups.
}
-\details{
- ~~ If necessary, more details than the description above ~~
-}
\source{
- ~~ reference to a publication or URL from which the data were obtained ~~
+ [reference?]
}
-\references{
- ~~ possibly secondary sources and usages ~~
-}
\examples{
Families["Liriodendron"]
Modified: pkg/man/LookupTL.Rd
===================================================================
--- pkg/man/LookupTL.Rd 2009-10-21 03:32:43 UTC (rev 42)
+++ pkg/man/LookupTL.Rd 2009-10-21 22:22:30 UTC (rev 43)
@@ -3,7 +3,7 @@
\docType{data}
\title{Family-based lookup table for minimum tip lengths}
\description{
- ~~ A concise (1-5 lines) description of the dataset. ~~
+ TODO
}
\format{
A data frame with information on 404 families, referenced by rowname:
@@ -17,12 +17,12 @@
}
}
\details{
- ~~ If necessary, more details than the description above ~~
+ TODO
}
\source{
- ~~ reference to a publication or URL from which the data were obtained ~~
+ TODO
}
\references{
- ~~ possibly secondary sources and usages ~~
+ TODO
}
\keyword{datasets}
Modified: pkg/man/Supertree.Rd
===================================================================
--- pkg/man/Supertree.Rd 2009-10-21 03:32:43 UTC (rev 42)
+++ pkg/man/Supertree.Rd 2009-10-21 22:22:30 UTC (rev 43)
@@ -9,12 +9,9 @@
Supertree is of class phylo (from the ape package), with 379 tips.
}
\details{
- ~~ If necessary, more details than the description above ~~
+ TODO
}
\source{
- ~~ reference to a publication or URL from which the data were obtained ~~
+ TODO
}
-\references{
- ~~ possibly secondary sources and usages ~~
-}
\keyword{datasets}
Modified: pkg/man/abundance.Rd
===================================================================
--- pkg/man/abundance.Rd 2009-10-21 03:32:43 UTC (rev 42)
+++ pkg/man/abundance.Rd 2009-10-21 22:22:30 UTC (rev 43)
@@ -1,17 +1,17 @@
\name{abundance}
\alias{abundance}
\alias{abundance<-}
-\title{ Get or set species abundances }
+\title{Get or set species abundances}
\description{
Functions to get or set the abundances of tip taxa in a phylogenetic
tree.
}
\usage{
- abundance(tree)
- abundance(tree) <- value
+ abundance(phy)
+ abundance(phy) <- value
}
\arguments{
- \item{tree}{An object of class \code{phylo4d}.}
+ \item{phy}{a \code{phylo4d} object}
\item{value}{Numeric vector of length equal to the number of tips in
the tree. Order should correspond to the output of nodeId(tree,
type="tip").}
@@ -29,7 +29,7 @@
For \code{abundance}, a named vector of the same length as tips of
tree. For \code{abundance<-}, the updated tree.
}
-\author{Jim Regetz}
+\author{Jim Regetz (regetz at nceas.ucsb.edu)}
\examples{
data(weeds)
abundance(weeds$A)
Modified: pkg/man/caterpillar.Rd
===================================================================
--- pkg/man/caterpillar.Rd 2009-10-21 03:32:43 UTC (rev 42)
+++ pkg/man/caterpillar.Rd 2009-10-21 22:22:30 UTC (rev 43)
@@ -1,14 +1,12 @@
\name{caterpillar}
\alias{caterpillar}
-%- Also NEED an '\alias' for EACH other topic documented here.
-\title{ ~~function to do ... ~~ }
+\title{ Caterpillar plots }
\description{
- ~~ A concise (1-5 lines) description of what the function does. ~~
+ Caterpillar plots
}
\usage{
-caterpillar(data, center = c("mean", "median"), sort = TRUE, ...)
+ caterpillar(data, center = c("mean", "median"), sort = TRUE, ...)
}
-%- maybe also 'usage' for other objects documented here.
\arguments{
\item{data}{ ~~Describe \code{data} here~~ }
\item{center}{ ~~Describe \code{center} here~~ }
@@ -26,12 +24,7 @@
...
}
\references{ ~put references to the literature/web site here ~ }
-\author{ ~~who you are~~ }
-\note{ ~~further notes~~
-
- ~Make other sections like Warning with \section{Warning }{....} ~
-}
-\seealso{ ~~objects to See Also as \code{\link{help}}, ~~~ }
+\author{Jim Regetz}
\examples{
##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
Deleted: pkg/man/commPD.Rd
===================================================================
--- pkg/man/commPD.Rd 2009-10-21 03:32:43 UTC (rev 42)
+++ pkg/man/commPD.Rd 2009-10-21 22:22:30 UTC (rev 43)
@@ -1,37 +0,0 @@
-\name{commPD}
-\alias{commPD}
-%- Also NEED an '\alias' for EACH other topic documented here.
-\title{ ~~function to do ... ~~ }
-\description{
- ~~ A concise (1-5 lines) description of what the function does. ~~
-}
-\usage{
-commPD(tree, method = c("traditional", "polytomy", "yule"))
-}
-%- maybe also 'usage' for other objects documented here.
-\arguments{
- \item{tree}{ ~~Describe \code{tree} here~~ }
- \item{method}{ ~~Describe \code{method} here~~ }
-}
-\details{
- ~~ If necessary, more details than the description above ~~
-}
-\value{
- ~Describe the value returned
- If it is a LIST, use
- \item{comp1 }{Description of 'comp1'}
- \item{comp2 }{Description of 'comp2'}
- ...
-}
-\references{ ~put references to the literature/web site here ~ }
-\author{ ~~who you are~~ }
-\note{ ~~further notes~~
-
- ~Make other sections like Warning with \section{Warning }{....} ~
-}
-\seealso{ ~~objects to See Also as \code{\link{help}}, ~~~ }
-\examples{
-##---- Should be DIRECTLY executable !! ----
-##-- ==> Define data, use random,
-##-- or do help(data=index) for the standard data sets.
-}
Deleted: pkg/man/doByCommunity.Rd
===================================================================
--- pkg/man/doByCommunity.Rd 2009-10-21 03:32:43 UTC (rev 42)
+++ pkg/man/doByCommunity.Rd 2009-10-21 22:22:30 UTC (rev 43)
@@ -1,39 +0,0 @@
-\name{doByCommunity}
-\alias{doByCommunity}
-%- Also NEED an '\alias' for EACH other topic documented here.
-\title{ ~~function to do ... ~~ }
-\description{
- ~~ A concise (1-5 lines) description of what the function does. ~~
-}
-\usage{
-doByCommunity(ecophylo, FUN, simplify = TRUE, ...)
-}
-%- maybe also 'usage' for other objects documented here.
-\arguments{
- \item{ecophylo}{ ~~Describe \code{ecophylo} here~~ }
- \item{FUN}{ ~~Describe \code{FUN} here~~ }
- \item{simplify}{ ~~Describe \code{simplify} here~~ }
- \item{\dots}{ ~~Describe \code{...} here~~ }
-}
-\details{
- ~~ If necessary, more details than the description above ~~
-}
-\value{
- ~Describe the value returned
- If it is a LIST, use
- \item{comp1 }{Description of 'comp1'}
- \item{comp2 }{Description of 'comp2'}
- ...
-}
-\references{ ~put references to the literature/web site here ~ }
-\author{ ~~who you are~~ }
-\note{ ~~further notes~~
-
- ~Make other sections like Warning with \section{Warning }{....} ~
-}
-\seealso{ ~~objects to See Also as \code{\link{help}}, ~~~ }
-\examples{
-##---- Should be DIRECTLY executable !! ----
-##-- ==> Define data, use random,
-##-- or do help(data=index) for the standard data sets.
-}
Modified: pkg/man/ecophylo.Rd
===================================================================
--- pkg/man/ecophylo.Rd 2009-10-21 03:32:43 UTC (rev 42)
+++ pkg/man/ecophylo.Rd 2009-10-21 22:22:30 UTC (rev 43)
@@ -1,41 +1,46 @@
\name{ecophylo}
-\alias{ecophylo}
-%- Also NEED an '\alias' for EACH other topic documented here.
-\title{ ~~function to do ... ~~ }
+\alias{phylo4com}
+\title{Create list of community phylogenies}
\description{
- ~~ A concise (1-5 lines) description of what the function does. ~~
+ Function to combine species abundance data with phylogenetic
+ information for a set of communities.
}
\usage{
-ecophylo(communityID, species, abundance, tree)
+ phylo4com(communityID, species, abundance, tree,
+ missing=c("warn", "OK", "fail"))
}
\arguments{
- \item{communityID}{ Vector of community identifiers }
- \item{species}{ Vector of species names; must correspond to tip labels
- of the supplied tree }
- \item{abundance}{ Numeric vector of abundances of each species in each
- community }
- \item{tree}{ Phylogenetic tree (phylo format) of all species across
- all communities }
+ \item{communityID}{Vector of community identifiers.}
+ \item{species}{Vector of species names; must correspond to tip labels
+ of the supplied tree.}
+ \item{abundance}{Numeric vector of abundances of each species in each
+ community.}
+ \item{tree}{A \code{phylo4} object (or one that inherits from it).}
+ \item{missing}{(not currently implemented) What to do if some
+ requested node IDs or names are not in the tree: warn, do nothing,
+ or stop with an error.}
}
\details{
- ~~ If necessary, more details than the description above ~~
+ TODO
+
+ If the species vector contains values that do not appear in the tree,
+ they are ignored with a warning. If a community has fewer than one
+ species matched in the tree, an error will result. In both cases, the
+ behavior is simply a result of how the phylobase \code{subset} method
+ works; see the help page for this method for more information.
}
\value{
- ~Describe the value returned
- If it is a LIST, use
- \item{comp1 }{Description of 'comp1'}
- \item{comp2 }{Description of 'comp2'}
- ...
+ A list of \code{phylo4d} objects, one per unique value in the
+ \code{communityID} vector. List element names are taken from the
+ \code{communityID} vector.
}
-\references{ ~put references to the literature/web site here ~ }
-\author{ ~~who you are~~ }
-\note{ ~~further notes~~
-
- ~Make other sections like Warning with \section{Warning }{....} ~
+\author{Jim Regetz (regetz at nceas.ucsb.edu)}
+\seealso{
+ \code{\link[phylobase]{subset}} in the phylobase package
}
-\seealso{ ~~objects to See Also as \code{\link{help}}, ~~~ }
\examples{
-##---- Should be DIRECTLY executable !! ----
-##-- ==> Define data, use random,
-##-- or do help(data=index) for the standard data sets.
+ ##TODO -- contruction example
+ # Example of a phylo4com result
+ data(weeds)
+ print(weeds)
}
Modified: pkg/man/genera.Rd
===================================================================
--- pkg/man/genera.Rd 2009-10-21 03:32:43 UTC (rev 42)
+++ pkg/man/genera.Rd 2009-10-21 22:22:30 UTC (rev 43)
@@ -1,42 +1,28 @@
\name{genera}
\alias{genera}
-%- Also NEED an '\alias' for EACH other topic documented here.
-\title{ ~~function to do ... ~~ }
+\title{Extract genus names}
\description{
- ~~ A concise (1-5 lines) description of what the function does. ~~
+ Helper function to extract the genus names from phylogeny tip labels
+ in the case when those labels are scientific names using binomial
+ nomenclature.
}
\usage{
-genera(tree)
+ genera(phy)
}
-%- maybe also 'usage' for other objects documented here.
\arguments{
- \item{tree}{ ~~Describe \code{tree} here~~ }
+ \item{phy}{a \code{phylo4} object (or one that inherits from it)}
}
\details{
- ~~ If necessary, more details than the description above ~~
+ This is a simple function that assumes the tip labels of phylogeny
+ \code{phy} are of the form \dQuote{genus_species}. It does no checking
+ whatsoever to check whether this is in fact the case.
}
\value{
- ~Describe the value returned
- If it is a LIST, use
- \item{comp1 }{Description of 'comp1'}
- \item{comp2 }{Description of 'comp2'}
- ...
+ A character vector containing the genus portion of the tip labels,
+ with element names corresponding to the numeric tip node ID.
}
-\references{ ~put references to the literature/web site here ~ }
-\author{ ~~who you are~~ }
-\note{ ~~further notes~~
-
- ~Make other sections like Warning with \section{Warning }{....} ~
-}
-\seealso{ ~~objects to See Also as \code{\link{help}}, ~~~ }
+\author{Jim Regetz (regetz at nceas.ucsb.edu)}
\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) {
- #From taxa names in tree, remove "_" and species name after
- gsub("_.*$", "", tree$tip.label)
- }
+ data(weeds)
+ genera(weeds$A)
}
Deleted: pkg/man/getMinTL.Rd
===================================================================
--- pkg/man/getMinTL.Rd 2009-10-21 03:32:43 UTC (rev 42)
+++ pkg/man/getMinTL.Rd 2009-10-21 22:22:30 UTC (rev 43)
@@ -1,81 +0,0 @@
-\name{getMinTL}
-\alias{getMinTL}
-%- Also NEED an '\alias' for EACH other topic documented here.
-\title{ ~~function to do ... ~~ }
-\description{
- ~~ A concise (1-5 lines) description of what the function does. ~~
-}
-\usage{
-getMinTL(tree, genera)
-}
-%- maybe also 'usage' for other objects documented here.
-\arguments{
- \item{tree}{ ~~Describe \code{tree} here~~ }
- \item{genera}{ ~~Describe \code{families} here~~ }
-}
-\details{
- ~~ If necessary, more details than the description above ~~
-}
-\value{
- ~Describe the value returned
- If it is a LIST, use
- \item{comp1 }{Description of 'comp1'}
- \item{comp2 }{Description of 'comp2'}
- ...
-}
-\references{ ~put references to the literature/web site here ~ }
-\author{ ~~who you are~~ }
-\note{ ~~further notes~~
-
- ~Make other sections like Warning with \section{Warning }{....} ~
-}
-\seealso{ ~~objects to See Also as \code{\link{help}}, ~~~ }
-\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, families=NULL, supertree, lookup) {
-
- # TODO: if genus not in FamGen lookup table, need to give warning. but
- # right now the lookup happens before this function gets called
-
- # if Family is not in the MinTL lookup table give a warning, and later
- # use minTL based on average across all families in the lookup table
- if (!all(families \%in\% row.names(lookup))) {
- warning("one or more taxa missing from lookup table; using mean minTL")
- }
-
- familiesInSupertree <- lookup[families, "Davies.phylogeny"]
- familiesInSupertree <- as.character(familiesInSupertree)
-
- # Subset the supertree using families from the user-supplied tree. If
- # any user-supplied taxa cannot be matched to families in the
- # supertree, they are simply ignored
- subsupertree <- subset(supertree, na.omit(familiesInSupertree))
- subsupertree.maxLength <- max(cophenetic(subsupertree))/2
- tree.maxLength <- max(cophenetic(tree))/2
-
- tableTL <- lookup[familiesInSupertree, "MinBL"]
-
- # if any TLs are 0 or NA, give warning and use average minTL across
- # all families in the lookup_MinTL table
- if(any(tableTL==0 | is.na(tableTL))) {
- numNA <- sum(tableTL==0 | is.na(tableTL))
- warning("Using meanTL for ", numNA, " tip", if(numNA>1) "s")
- # calculate average minTL across the entire minTL lookup table,
- # excluding any non-positive or NA values
- meanMinTL <- mean(lookup[["MinBL"]][lookup[["MinBL"]]>0], na.rm=TRUE)
- tableTL[is.na(tableTL)] <- meanMinTL
- tableTL[tableTL<=0] <- meanMinTL
- }
-
- lookupTL <- tableTL * (tree.maxLength / subsupertree.maxLength)
- actualTL <- tipLengths(tree)
- minTL <- ifelse(lookupTL < actualTL, lookupTL, actualTL)
-
- return(minTL)
-
- }
-}
Modified: pkg/man/minTL.Rd
===================================================================
--- pkg/man/minTL.Rd 2009-10-21 03:32:43 UTC (rev 42)
+++ pkg/man/minTL.Rd 2009-10-21 22:22:30 UTC (rev 43)
@@ -1,35 +1,31 @@
\name{minTL}
-\alias{minTL<-}
\alias{minTL}
-\title{ Species minTLs in a phylogeny }
+\alias{minTL<-}
+\title{Get or set minimum tip lengths}
\description{
-Functions to get or set species minimum tip lengths (minTL)
+ Functions to get or set species minimum tip lengths (minTL) for a
+ phylogeny.
}
\usage{
-minTL(tree)
-minTL(tree) <- value
+ minTL(phy)
+ minTL(phy) <- value
}
\arguments{
- \item{tree}{ A phylogenetic tree (i.e. an object of class '"phylo"')}
- \item{value}{ Numeric vector of length equal to the number of tips in
-tree. Order should correspond to the order of species given by
-tree\$tip.label }
+ \item{phy}{a \code{phylo4d} object}
+ \item{value}{Numeric vector of length equal to the number of tips in
+ the tree. Order should correspond to the output of nodeId(tree,
+ type="tip").}
}
\details{
- ~~ If necessary, more details than the description above ~~
+ TODO
}
\value{
- For 'minTL', 'NULL' or a named vector of the same length as
- tips of tree. ('NULL' is given if the tree has no assigned
- minTL values.) For 'minTL<-', the updated tree.
+ For \code{minTL}, a named numeric vector of the same length as tips of
+ tree. (\code{NULL} is returned if the tree has no assigned minTL
+ values.) For \code{minTL<-}, the updated tree.
}
-\author{ Jim Regetz }
-\note{ ~~further notes~~
-
- ~Make other sections like Warning with \section{Warning }{....} ~
-}
+\author{Jim Regetz (regetz at nceas.ucsb.edu)}
\examples{
-##---- Should be DIRECTLY executable !! ----
-##-- ==> Define data, use random,
-##-- or do help(data=index) for the standard data sets.
+ data(weeds)
+ minTL(weeds$A)
}
Modified: pkg/man/pd.Rd
===================================================================
--- pkg/man/pd.Rd 2009-10-21 03:32:43 UTC (rev 42)
+++ pkg/man/pd.Rd 2009-10-21 22:22:30 UTC (rev 43)
@@ -1,41 +1,26 @@
\name{pd}
\alias{pd}
-%- Also NEED an '\alias' for EACH other topic documented here.
-\title{ ~~function to do ... ~~ }
+\title{Calculate phylogenetic diversity}
\description{
- ~~ A concise (1-5 lines) description of what the function does. ~~
+ Calculates PD (phylogenetic diversity) for a phylogeny
}
\usage{
-pd(tree)
+ pd(phy)
}
-%- maybe also 'usage' for other objects documented here.
\arguments{
- \item{tree}{ ~~Describe \code{tree} here~~ }
+ \item{phy}{a \code{phylo4} object (or one that inherits from it)}
}
\details{
- ~~ If necessary, more details than the description above ~~
+ TODO
}
\value{
- ~Describe the value returned
- If it is a LIST, use
- \item{comp1 }{Description of 'comp1'}
- \item{comp2 }{Description of 'comp2'}
- ...
+ A numeric vector of length 1.
}
-\references{ ~put references to the literature/web site here ~ }
-\author{ ~~who you are~~ }
-\note{ ~~further notes~~
-
- ~Make other sections like Warning with \section{Warning }{....} ~
+\references{
+ TODO
}
-\seealso{ ~~objects to See Also as \code{\link{help}}, ~~~ }
+\author{Jim Regetz (regetz at nceas.ucsb.edu)}
\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) {
- sum(tree$edge.length)
- }
+ data(weeds)
+ pd(weeds$A)
}
Deleted: pkg/man/print.ecophylo.Rd
===================================================================
--- pkg/man/print.ecophylo.Rd 2009-10-21 03:32:43 UTC (rev 42)
+++ pkg/man/print.ecophylo.Rd 2009-10-21 22:22:30 UTC (rev 43)
@@ -1,43 +0,0 @@
-\name{print.ecophylo}
-\alias{print.ecophylo}
-%- Also NEED an '\alias' for EACH other topic documented here.
-\title{ ~~function to do ... ~~ }
-\description{
- ~~ A concise (1-5 lines) description of what the function does. ~~
-}
-\usage{
-print.ecophylo(x, \dots)
-}
-%- maybe also 'usage' for other objects documented here.
-\arguments{
- \item{x}{ an object of class \code{"ecophylo"} }
- \item{\dots}{ Additional variables }
-}
-\details{
- ~~ If necessary, more details than the description above ~~
-}
-\value{
- ~Describe the value returned
- If it is a LIST, use
- \item{comp1 }{Description of 'comp1'}
- \item{comp2 }{Description of 'comp2'}
- ...
-}
-\references{ ~put references to the literature/web site here ~ }
-\author{ ~~who you are~~ }
-\note{ ~~further notes~~
-
- ~Make other sections like Warning with \section{Warning }{....} ~
-}
-\seealso{ ~~objects to See Also as \code{\link{help}}, ~~~ }
-\examples{
-print(Supertree, c("Acanthaceae", "Zygophyllaceae"))
-
-# Unmatched tipNames will generate an error...
-\dontrun{print(Supertree, c("Acanthaceae", "Zygophyllaceae",
-"unknown"))}
-
-# Unless checkMissing is FALSE
-print(Supertree, c("Acanthaceae", "Zygophyllaceae", "unknown"),
-checkMissing=FALSE)
-}
Modified: pkg/man/siteBySpecies.Rd
===================================================================
--- pkg/man/siteBySpecies.Rd 2009-10-21 03:32:43 UTC (rev 42)
+++ pkg/man/siteBySpecies.Rd 2009-10-21 22:22:30 UTC (rev 43)
@@ -6,11 +6,11 @@
list.
}
\usage{
-siteBySpecies(phylo4com, presence=FALSE, transpose=FALSE)
+siteBySpecies(phylo4com, presence.only=FALSE, transpose=FALSE)
}
\arguments{
\item{phylo4com}{A list of phylo4d objects with abundance data}
- \item{presence}{(logical) Should abundance values be replaced
+ \item{presence.only}{(logical) Should abundance values be replaced
with 1/0 indicators of presence/absence? Default FALSE.}
\item{transpose}{(logical) Should matrix be transposed to put
species in rows and sites in columns? Default FALSE.}
Modified: pkg/man/tipLength.Rd
===================================================================
--- pkg/man/tipLength.Rd 2009-10-21 03:32:43 UTC (rev 42)
+++ pkg/man/tipLength.Rd 2009-10-21 22:22:30 UTC (rev 43)
@@ -5,19 +5,19 @@
Returns the lengths of all tip edges of a phylogeny.
}
\usage{
- tipLength(x)
+ tipLength(phy)
}
\arguments{
- \item{x}{a \code{phylo4} object (or one that inherits from it)}
+ \item{phy}{a \code{phylo4} object (or one that inherits from it)}
}
\value{
Numeric vector of lengths, with the associated tip node labels as
names.
}
-\author{Jim Regetz}
+\author{Jim Regetz (regetz at nceas.ucsb.edu)}
\seealso{
- This function is a simple wrapper of the \code{\link{edgeLength}}
- phylobase method.
+ This function is a simple wrapper of the
+ \code{\link[phylobase:phylo4-accessors]{edgeLength}} phylobase method.
}
\examples{
data(weeds)
Deleted: pkg/man/weightByAbund.Rd
===================================================================
--- pkg/man/weightByAbund.Rd 2009-10-21 03:32:43 UTC (rev 42)
+++ pkg/man/weightByAbund.Rd 2009-10-21 22:22:30 UTC (rev 43)
@@ -1,71 +0,0 @@
-\name{weightByAbund}
-\alias{weightByAbund}
-%- Also NEED an '\alias' for EACH other topic documented here.
-\title{ ~~function to do ... ~~ }
-\description{
- ~~ A concise (1-5 lines) description of what the function does. ~~
-}
-\usage{
-weightByAbund(tree, method = c("polytomy", "yule"))
-}
-%- maybe also 'usage' for other objects documented here.
-\arguments{
- \item{tree}{ ~~Describe \code{tree} here~~ }
- \item{method}{ ~~Describe \code{method} here~~ }
-}
-\details{
- ~~ If necessary, more details than the description above ~~
-}
-\value{
- ~Describe the value returned
- If it is a LIST, use
- \item{comp1 }{Description of 'comp1'}
- \item{comp2 }{Description of 'comp2'}
- ...
-}
-\references{ ~put references to the literature/web site here ~ }
-\author{ ~~who you are~~ }
-\note{ ~~further notes~~
-
- ~Make other sections like Warning with \section{Warning }{....} ~
-}
-\seealso{ ~~objects to See Also as \code{\link{help}}, ~~~ }
-\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, minLength,
- method=c("polytomy", "yule")) {
-
-###Jim, why the match.arg?
- method <- match.arg(method)
-
- if (is.null(abundance(tree))) {
- stop("tree contains no abundance information")
- }
-
- tipRowID <- which(tree$edge[, 2] <= Ntip(tree))
- tipLen <- tree$edge.length[tipRowID]
- tipID <- tree$edge[tipRowID,2]
-
- n <- abundance(tree)[tipID]
-
- # Test statement:
- if (!identical(names(n), names(minLength))) {
- stop("mismatch between abundance and minTL vectors")
- }
-
- if (method=="polytomy") {
- tree$edge.length[tipRowID] <- tipLen + (n-1) * minLength
- } else if (method=="yule") {
- C <- 0.57722
- tree$edge.length[tipRowID] <- tipLen - minLength +
- (minLength * (n-1) / (log(n) + C-1))
- }
-
- return(tree)
-
- }
-}
More information about the Ecopd-commits
mailing list