[Vegan-commits] r484 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Aug 25 09:29:25 CEST 2008


Author: jarioksa
Date: 2008-08-25 09:29:25 +0200 (Mon, 25 Aug 2008)
New Revision: 484

Modified:
   pkg/R/oecosimu.R
   pkg/R/print.oecosimu.R
Log:
oecosimu: cleaner print

Modified: pkg/R/oecosimu.R
===================================================================
--- pkg/R/oecosimu.R	2008-08-24 16:58:35 UTC (rev 483)
+++ pkg/R/oecosimu.R	2008-08-25 07:29:25 UTC (rev 484)
@@ -53,6 +53,8 @@
     p <- (p + 1)/(nsimul + 1)
     if (is.null(names(indstat)))
         names(indstat) <- "Statistic"
+    if (!is.list(ind))
+        ind <- list(statistic = ind)
     ind$oecosimu <- list(z = z, pval = p, simulated=simind, method=method,
                          statistic = indstat)
     class(ind) <- c("oecosimu", class(ind))

Modified: pkg/R/print.oecosimu.R
===================================================================
--- pkg/R/print.oecosimu.R	2008-08-24 16:58:35 UTC (rev 483)
+++ pkg/R/print.oecosimu.R	2008-08-25 07:29:25 UTC (rev 484)
@@ -3,17 +3,21 @@
 {
     cat("oecosimu with", ncol(x$oecosimu$simulated), "simulations\n")
     cat("simulation method", x$oecosimu$method)
-    if (length(att <- attributes(x$oecosimu$simulated)) > 0) {
+    ## dim attribute is always there, but print all others
+    if (length(att <- attributes(x$oecosimu$simulated)) > 1) {
+        att$dim <- NULL
         cat(" with", paste(names(att), att, collapse=", "))
     }
     cat("\n\n")
+    cl <- class(x)
+    if (length(cl) > 1 && cl[2] != "list") {
+        NextMethod("print", x)
+        cat("\n")
+    }
     qu <- apply(x$oecosimu$simulated, 1, quantile, probs=c(0.025, 0.5, 0.975))
     m <- cbind("statistic" = x$oecosimu$statistic,
                "z" = x$oecosimu$z, t(qu),
                "Pr(sim.)"=x$oecosimu$pval)
-    printCoefmat(m)
-    cl <- class(x)
-    if (length(cl) > 1 && cl[2] != "list")
-        NextMethod("print", x)
+    printCoefmat(m, ...)
     invisible(x)   
 }



More information about the Vegan-commits mailing list