[Vegan-commits] r423 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jun 12 07:33:59 CEST 2008


Author: psolymos
Date: 2008-06-12 07:33:59 +0200 (Thu, 12 Jun 2008)
New Revision: 423

Modified:
   pkg/R/permat.R
Log:
fix summary.permat for row/sum total comparisons


Modified: pkg/R/permat.R
===================================================================
--- pkg/R/permat.R	2008-06-11 06:59:27 UTC (rev 422)
+++ pkg/R/permat.R	2008-06-12 05:33:59 UTC (rev 423)
@@ -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] <- 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
+        vrow[i] <- sum(rowSums(x$orig) == rowSums(x$perm[[i]])) == nrow(x$orig)
+        vcol[i] <- sum(colSums(x$orig) == colSums(x$perm[[i]])) == ncol(x$orig)
+        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