[Vegan-commits] r1601 - in pkg/vegan: R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu May 12 16:38:42 CEST 2011
Author: jarioksa
Date: 2011-05-12 16:38:42 +0200 (Thu, 12 May 2011)
New Revision: 1601
Modified:
pkg/vegan/R/treeheight.R
pkg/vegan/inst/ChangeLog
Log:
dramatic simplification of treedist
Modified: pkg/vegan/R/treeheight.R
===================================================================
--- pkg/vegan/R/treeheight.R 2011-05-08 19:08:21 UTC (rev 1600)
+++ pkg/vegan/R/treeheight.R 2011-05-12 14:38:42 UTC (rev 1601)
@@ -4,17 +4,6 @@
if (inherits(tree, "spantree"))
return(sum(tree$dist))
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
+ sum(tree$height) + max(tree$height)
}
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2011-05-08 19:08:21 UTC (rev 1600)
+++ pkg/vegan/inst/ChangeLog 2011-05-12 14:38:42 UTC (rev 1601)
@@ -10,6 +10,8 @@
needed in R 2.13.0 and should be released soon (there is no need
to add R >= 2.13.0 dependence as long as we do not use these
functions ourselves within released vegan code).
+
+ * treeheight: dramatic simplification and speed-up of the code.
Version 1.18-29 (closed April 27, 2011)
More information about the Vegan-commits
mailing list