[Vegan-commits] r670 - in pkg/vegan: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jan 23 06:41:10 CET 2009


Author: psolymos
Date: 2009-01-23 06:41:10 +0100 (Fri, 23 Jan 2009)
New Revision: 670

Modified:
   pkg/vegan/R/lines.permat.R
   pkg/vegan/R/plot.permat.R
   pkg/vegan/R/print.summary.permat.R
   pkg/vegan/R/summary.permat.R
   pkg/vegan/man/nestedtemp.Rd
   pkg/vegan/man/permatfull.Rd
Log:
chisq modifications for easy handling


Modified: pkg/vegan/R/lines.permat.R
===================================================================
--- pkg/vegan/R/lines.permat.R	2009-01-20 09:47:14 UTC (rev 669)
+++ pkg/vegan/R/lines.permat.R	2009-01-23 05:41:10 UTC (rev 670)
@@ -2,10 +2,5 @@
 `lines.permat` <-
 function(x, type = "bray", ...)
 {
-    type <- match.arg(type, c("bray", "chisq"))
-    if (type == "bray")
-        toplot <- summary(x)$bray
-    if (type == "chisq")
-        toplot <- summary(x)$chisq$chisq.perm
-    lines(toplot, ...)
+    lines(summary(x)[[match.arg(type, c("bray", "chisq"))]], ...)
 }

Modified: pkg/vegan/R/plot.permat.R
===================================================================
--- pkg/vegan/R/plot.permat.R	2009-01-20 09:47:14 UTC (rev 669)
+++ pkg/vegan/R/plot.permat.R	2009-01-23 05:41:10 UTC (rev 670)
@@ -17,7 +17,7 @@
             ylab <- "Bray-Curtis dissimilarity"
     }
     if (type == "chisq") {
-        toplot <- summary(x)$chisq$chisq.perm
+        toplot <- summary(x)$chisq
         if (missing(ylab))
             ylab <- "Chi-squared"
     }

Modified: pkg/vegan/R/print.summary.permat.R
===================================================================
--- pkg/vegan/R/print.summary.permat.R	2009-01-20 09:47:14 UTC (rev 669)
+++ pkg/vegan/R/print.summary.permat.R	2009-01-23 05:41:10 UTC (rev 670)
@@ -34,9 +34,9 @@
         cat("\nSums within strata retained:", round(100 * sum(x$strsum) / n, digits), "%")
     cat("\n\nBray-Curtis dissimilarities among original and permuted matrices:\n")
     print(summary(x$bray))
-    cat("\nChi-squared for original matrix: ", round(x$chisq$chisq.orig, digits),
-        " (df = ", x$chisq$df, ")\n", sep = "")
+    cat("\nChi-squared for original matrix: ", round(attr(x$chisq, "chisq.orig"), digits),
+        " (df = ", attr(x$chisq, "df"), ")\n", sep = "")
     cat("Chi-squared values among expected and permuted matrices:\n")
-    print(summary(x$chisq$chisq.perm))
+    print(summary(x$chisq))
 invisible(x)
 }

Modified: pkg/vegan/R/summary.permat.R
===================================================================
--- pkg/vegan/R/summary.permat.R	2009-01-20 09:47:14 UTC (rev 669)
+++ pkg/vegan/R/summary.permat.R	2009-01-23 05:41:10 UTC (rev 670)
@@ -28,10 +28,9 @@
     } else ssum <- NULL
     ## Chisq
     E <- rs %o% cs / ss
-    chisq <- list(
-        chisq.orig = sum((x$orig - E)^2 / E),
-        df = (nr - 1) * (nc - 1),
-        chisq.perm = sapply(x$perm, function(z) sum((z - E)^2 / E)))
+    chisq <- sapply(x$perm, function(z) sum((z - E)^2 / E))
+    attr(chisq, "chisq.orig") <- sum((x$orig - E)^2 / E)
+    attr(chisq, "df") <- (nr - 1) * (nc - 1)
     x$perm <- NULL
     out <- list(x=x, bray=bray, chisq=chisq, sum=psum, fill=pfill, rowsums=vrow, colsums=vcol,
         browsums=brow, bcolsums=bcol, strsum=ssum)

Modified: pkg/vegan/man/nestedtemp.Rd
===================================================================
--- pkg/vegan/man/nestedtemp.Rd	2009-01-20 09:47:14 UTC (rev 669)
+++ pkg/vegan/man/nestedtemp.Rd	2009-01-23 05:41:10 UTC (rev 670)
@@ -142,7 +142,7 @@
   W. (1998). A comparative analysis of nested subset patterns of species
   composition. \emph{Oecologia} 113, 1--20.
   }
-\author{ Jari Oksanen and Gustavo Carvalho (\code{nestednodf}. }
+\author{ Jari Oksanen and Gustavo Carvalho (\code{nestednodf}). }
 
 \seealso{
   In general, the functions should be used with \code{\link{oecosimu}}

Modified: pkg/vegan/man/permatfull.Rd
===================================================================
--- pkg/vegan/man/permatfull.Rd	2009-01-20 09:47:14 UTC (rev 669)
+++ pkg/vegan/man/permatfull.Rd	2009-01-23 05:41:10 UTC (rev 670)
@@ -104,10 +104,10 @@
 
 The \code{summary} method returns a list containing mean
 Bray-Curtis dissimilarities calculated pairwise among original and
-permuted matrices, and check results of the constraints.  Note that when
-\code{strata} is used, calculation may take several seconds. 
+permuted matrices, Chi-square statistics, and check results of the constraints.  Note that when
+\code{strata} is used, calculation may take longer.
 
-The \code{plot} method also returns the Bray-Curtis dissimilarities invisibly.
+The \code{plot} method also returns the plotted values invisibly.
 }
 \references{
 Original references for presence-absence algorithms are given on help



More information about the Vegan-commits mailing list