[Vegan-commits] r463 - in pkg: . R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Aug 10 21:25:03 CEST 2008
Author: jarioksa
Date: 2008-08-10 21:25:03 +0200 (Sun, 10 Aug 2008)
New Revision: 463
Added:
pkg/R/treedive.R
pkg/R/treeheight.R
pkg/man/treedive.Rd
Modified:
pkg/DESCRIPTION
pkg/inst/ChangeLog
Log:
added functions for functional diversity a la Petchey & Gaston
Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION 2008-08-10 19:15:57 UTC (rev 462)
+++ pkg/DESCRIPTION 2008-08-10 19:25:03 UTC (rev 463)
@@ -1,7 +1,7 @@
Package: vegan
Title: Community Ecology Package
-Version: 1.14-8
-Date: July 30, 2008
+Version: 1.14-9
+Date: August 10, 2008
Author: Jari Oksanen, Roeland Kindt, Pierre Legendre, Bob O'Hara, Gavin L. Simpson,
Peter Solymos, M. Henry H. Stevens, Helene Wagner
Maintainer: Jari Oksanen <jari.oksanen at oulu.fi>
Added: pkg/R/treedive.R
===================================================================
--- pkg/R/treedive.R (rev 0)
+++ pkg/R/treedive.R 2008-08-10 19:25:03 UTC (rev 463)
@@ -0,0 +1,17 @@
+`treedive` <-
+ function(comm, tree)
+{
+ if (!inherits(tree, "hclust"))
+ stop("'clus' must be an 'hclust' result object")
+ m <- as.matrix(cophenetic(tree))
+ ## Repeat for sites
+ div <- numeric(nrow(comm))
+ for (i in 1:nrow(comm)) {
+ k <- comm[i,] > 0
+ d <- as.dist(m[k,k])
+ cl <- update(tree, d = d)
+ div[i] <- treeheight(cl)
+ }
+ div
+}
+
Added: pkg/R/treeheight.R
===================================================================
--- pkg/R/treeheight.R (rev 0)
+++ pkg/R/treeheight.R 2008-08-10 19:25:03 UTC (rev 463)
@@ -0,0 +1,18 @@
+`treeheight` <-
+ function(tree)
+{
+ tree <- as.hclust(tree)
+ m <- tree$merge
+ h <- tree$height
+ height <- 0
+ for (i in 1:nrow(m)) {
+ for (j in 1:2) {
+ if (m[i,j] < 0)
+ height <- height + h[i]
+ else
+ height <- height + h[i] - h[m[i,j]]
+ }
+ }
+ height
+}
+
Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog 2008-08-10 19:15:57 UTC (rev 462)
+++ pkg/inst/ChangeLog 2008-08-10 19:25:03 UTC (rev 463)
@@ -2,8 +2,14 @@
VEGAN DEVEL VERSIONS at http://r-forge.r-project.org/
-Versin 1.14-8 (opened July 30, 2008)
+Version 1.14-9 (open August 10, 2008)
+ * treedive: new functions for estimating functional diversity
+ defined as the height of a dendrogram of species properties for a
+ site (Petchey & Gaston). Still very preliminary.
+
+Version 1.14-8 (closed August 10, 2008)
+
* wcmdscale: new function to perform metric scaling
(a.k.a. principal coordinates analysis) with weights for points.
Added: pkg/man/treedive.Rd
===================================================================
--- pkg/man/treedive.Rd (rev 0)
+++ pkg/man/treedive.Rd 2008-08-10 19:25:03 UTC (rev 463)
@@ -0,0 +1,42 @@
+\name{treedive}
+\alias{treedive}
+\alias{treeheight}
+
+\title{ Functional Diversity estimated from Dendrogram Heights}
+\description{
+Functional diversity is defined as the total heights of connecting
+segments for a dendrogram of species properties for all species
+occurring in a site (Petchey and Gaston).
+}
+\usage{
+treedive(comm, tree)
+treeheight(tree)
+}
+
+\arguments{
+ \item{comm}{Community data frame or matrix.}
+ \item{tree}{A dendrogram which for \code{treedive} must be for species.}
+}
+\details{
+\dots To come \dots
+}
+\value{
+Diversity values rows of \code{comm} (a vector).
+}
+\references{Petchey and Gaston}
+\author{Jari Oksanen}
+
+\seealso{ \code{\link{taxondive}} is something very similar from
+another world. }
+\examples{
+## There is no data set on species properties yet, and therefore
+## the example uses taxonomy
+data(dune)
+data(dune.taxon)
+d <- taxa2dist(dune.taxon)
+cl <- hclust(d, "aver")
+treedive(dune, cl)
+}
+
+\keyword{ univar }
+
More information about the Vegan-commits
mailing list