[Vegan-commits] r820 - pkg/vegan/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri May 15 20:49:34 CEST 2009


Author: psolymos
Date: 2009-05-15 20:49:34 +0200 (Fri, 15 May 2009)
New Revision: 820

Modified:
   pkg/vegan/R/tsallis.R
Log:
tsallis bug fixed (hill=T, scales=1; resulted in division by zero)

Modified: pkg/vegan/R/tsallis.R
===================================================================
--- pkg/vegan/R/tsallis.R	2009-05-14 06:59:05 UTC (rev 819)
+++ pkg/vegan/R/tsallis.R	2009-05-15 18:49:34 UTC (rev 820)
@@ -29,7 +29,11 @@
             else result[, a] <- result[, a] / ((ST^(1-scales[a]) - 1) / (1 - scales[a]))
         }
         if (hill) {
-            result[, a] <- (1 - (scales[a] - 1) * result[, a])^(1/(1-scales[a]))
+            result[, a] <- if (scales[a] == 1) {
+                exp(result[, a])
+            } else {
+                (1 - (scales[a] - 1) * result[, a])^(1/(1-scales[a]))
+            }
         }
     }
     result <- as.data.frame(result)



More information about the Vegan-commits mailing list