[Vegan-commits] r923 - pkg/vegan/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Aug 12 22:13:21 CEST 2009
Author: jarioksa
Date: 2009-08-12 22:13:20 +0200 (Wed, 12 Aug 2009)
New Revision: 923
Added:
pkg/vegan/R/estaccumR.R
Removed:
pkg/vegan/R/estaccum.R
Log:
renamed estaccum.R to estaccumR.R
Deleted: pkg/vegan/R/estaccum.R
===================================================================
--- pkg/vegan/R/estaccum.R 2009-08-12 20:10:58 UTC (rev 922)
+++ pkg/vegan/R/estaccum.R 2009-08-12 20:13:20 UTC (rev 923)
@@ -1,21 +0,0 @@
-##" Individual based accumulation model. Similar to poolaccum but uses
-##estimateR. Inherits from "poolaccum" class and uses its methods.
-`estaccumR` <-
- function(x, permutations = 100)
-{
- n <- nrow(x)
- N <- seq_len(n)
- S <- chao <- ace <- matrix(0, nrow = n, ncol = permutations)
- for (i in 1:permutations) {
- take <- sample(n)
- tmp <- estimateR(apply(x[take,], 2, cumsum))
- S[,i] <- tmp[1,]
- chao[,i] <- tmp[2,]
- ace[, i] <- tmp[4,]
- }
- means <- cbind(N = N, S = rowMeans(S), Chao = rowMeans(chao),
- ACE = rowMeans(ace))
- out <- list(S = S, chao = chao, ace = ace, N = N, means = means)
- class(out) <- c("estaccumR", "poolaccum")
- out
-}
Copied: pkg/vegan/R/estaccumR.R (from rev 922, pkg/vegan/R/estaccum.R)
===================================================================
--- pkg/vegan/R/estaccumR.R (rev 0)
+++ pkg/vegan/R/estaccumR.R 2009-08-12 20:13:20 UTC (rev 923)
@@ -0,0 +1,21 @@
+##" Individual based accumulation model. Similar to poolaccum but uses
+##estimateR. Inherits from "poolaccum" class and uses its methods.
+`estaccumR` <-
+ function(x, permutations = 100)
+{
+ n <- nrow(x)
+ N <- seq_len(n)
+ S <- chao <- ace <- matrix(0, nrow = n, ncol = permutations)
+ for (i in 1:permutations) {
+ take <- sample(n)
+ tmp <- estimateR(apply(x[take,], 2, cumsum))
+ S[,i] <- tmp[1,]
+ chao[,i] <- tmp[2,]
+ ace[, i] <- tmp[4,]
+ }
+ means <- cbind(N = N, S = rowMeans(S), Chao = rowMeans(chao),
+ ACE = rowMeans(ace))
+ out <- list(S = S, chao = chao, ace = ace, N = N, means = means)
+ class(out) <- c("estaccumR", "poolaccum")
+ out
+}
More information about the Vegan-commits
mailing list