[Vegan-commits] r418 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jun 10 15:55:14 CEST 2008


Author: psolymos
Date: 2008-06-10 15:55:14 +0200 (Tue, 10 Jun 2008)
New Revision: 418

Modified:
   pkg/R/permat.R
Log:
summary was wrong when input was data.frame and not matrix


Modified: pkg/R/permat.R
===================================================================
--- pkg/R/permat.R	2008-06-10 04:29:09 UTC (rev 417)
+++ pkg/R/permat.R	2008-06-10 13:55:14 UTC (rev 418)
@@ -148,10 +148,10 @@
         bray[i] <- sum(abs(x$orig-x$perm[[i]]))/sum(x$orig+x$perm[[i]])
         psum[i] <- sum(x$orig) == sum(x$perm[[i]])
         pfill[i] <- sum(x$orig > 0) == sum(x$perm[[i]] > 0)
-        vrow[i] <- identical(rowSums(x$orig), rowSums(x$perm[[i]]))
-        vcol[i] <- identical(colSums(x$orig), colSums(x$perm[[i]]))
-        if (restr) ssum[i] <- identical(rowSums(aggregate(x$orig,list(x$specs$reg),sum)),
-            rowSums(aggregate(x$perm[[i]],list(x$specs$reg),sum)))
+        vrow[i] <- sum(rowSums(x$orig)) == sum(rowSums(x$perm[[i]]))
+        vcol[i] <- sum(colSums(x$orig)) == sum(colSums(x$perm[[i]]))
+        if (restr) ssum[i] <- sum(rowSums(aggregate(x$orig,list(int),sum)[,-1]) ==
+            rowSums(aggregate(x$perm[[i]],list(int),sum)[,-1])) == nlev
         }
     strsum <- if (restr) sum(ssum)/n else NA
     outv <- c(sum=sum(psum)/n, fill=sum(pfill)/n, rowsums=sum(vrow)/n, colsums=sum(vcol)/n, strsum=strsum)



More information about the Vegan-commits mailing list