[Vegan-commits] r2400 - in pkg/vegan: . R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Feb 2 08:31:04 CET 2013


Author: jarioksa
Date: 2013-02-02 08:31:03 +0100 (Sat, 02 Feb 2013)
New Revision: 2400

Modified:
   pkg/vegan/DESCRIPTION
   pkg/vegan/R/oecosimu.R
   pkg/vegan/R/print.oecosimu.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/oecosimu.Rd
Log:
oecosimu: better fix than r2394 -- changes the structure of the result object

Modified: pkg/vegan/DESCRIPTION
===================================================================
--- pkg/vegan/DESCRIPTION	2013-01-31 13:48:28 UTC (rev 2399)
+++ pkg/vegan/DESCRIPTION	2013-02-02 07:31:03 UTC (rev 2400)
@@ -1,7 +1,7 @@
 Package: vegan
 Title: Community Ecology Package
-Version: 2.1-24
-Date: January 25, 2013
+Version: 2.1-25
+Date: February 2, 2013
 Author: Jari Oksanen, F. Guillaume Blanchet, Roeland Kindt, Pierre Legendre, 
    Peter R. Minchin, R. B. O'Hara, Gavin L. Simpson, Peter Solymos, 
    M. Henry H. Stevens, Helene Wagner  

Modified: pkg/vegan/R/oecosimu.R
===================================================================
--- pkg/vegan/R/oecosimu.R	2013-01-31 13:48:28 UTC (rev 2399)
+++ pkg/vegan/R/oecosimu.R	2013-02-02 07:31:03 UTC (rev 2400)
@@ -123,17 +123,12 @@
 
     if (is.null(names(indstat)) && length(indstat) == 1)
         names(indstat) <- statistic
-    ## $oecosimu cannot be added to a data frame, but this gives
-    ## either an error or a mess
-    if (is.data.frame(ind))
-        ind <- as.list(ind)
-    if (!is.list(ind))
-        ind <- list(statistic = ind)
-    ind$oecosimu <- list(z = z, means = means, pval = p, simulated=simind,
-                         method=method, statistic = indstat,
-                         alternative = alternative, isSeq = attr(x, "isSeq"))
-    attr(ind, "call") <- match.call()
-    class(ind) <- c("oecosimu", class(ind))
-    ind
+    oecosimu <- list(z = z, means = means, pval = p, simulated=simind,
+                     method=method, statistic = indstat,
+                     alternative = alternative, isSeq = attr(x, "isSeq"))
+    out <- list(statistic = ind, oecosimu = oecosimu)
+    attr(out, "call") <- match.call()
+    class(out) <- "oecosimu"
+    out
 }
 

Modified: pkg/vegan/R/print.oecosimu.R
===================================================================
--- pkg/vegan/R/print.oecosimu.R	2013-01-31 13:48:28 UTC (rev 2399)
+++ pkg/vegan/R/print.oecosimu.R	2013-02-02 07:31:03 UTC (rev 2400)
@@ -20,10 +20,10 @@
     ## dim attribute is always there, but print all others
 
     cat("\n\n")
-    cl <- class(x)
-    if ((length(cl) > 1 && cl[2] != "list" ) &&
-        !any(cl %in% c("adipart", "hiersimu", "multipart"))) {
-            NextMethod("print", x)
+
+    if (!inherits(x, c("adipart", "hiersimu", "multipart")) &&
+        !inherits(x$statistic, c("numeric", "list"))) {
+            print(x$statistic)
             cat("\n")
     }
     probs <- switch(x$oecosimu$alternative,

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2013-01-31 13:48:28 UTC (rev 2399)
+++ pkg/vegan/inst/ChangeLog	2013-02-02 07:31:03 UTC (rev 2400)
@@ -2,8 +2,21 @@
 
 VEGAN DEVEL VERSIONS at http://r-forge.r-project.org/
 
-Version 2.1-24 (opened January 25, 2013)
+Version 2.1-25 (opened February 2, 2013)
 
+	* oecosimu: changed the structure of the oecosimu() result
+	object. It now returns a list of two items: "statistic" is the
+	observed statistic, and "oecosimu" which contains the simulation
+	records. In previous version the function returned the statistic
+	and added item "oecosimu" there. Previously, the result object was
+	of type c("oecosimu", class(statistic)) as the original
+	"statistic" object was returned amended with an "oecosimu" item,
+	but now it is only of type "oecosimu" with the original
+	"statistic" as a separate item. So "statistic" is now one level
+	deeper instead of being the main object.
+	
+Version 2.1-24 (closed February 2, 2013)
+
 	* simulate.nullmodel: output array inherits dimnames after the
 	input data matrix, this is often required by oecosimu.
 	Dimension names are now only stored once for all nsim
@@ -20,9 +33,8 @@
 	(like would be the case if the 'statistic' was extracted from a
 	data frame). It is now checked that only one 'statistic' is given
 	and a comprehensible error message is issued instead of the
-	current confusing one. The changes were trickered in an attempt to
-	use picante::pd(), but this still fails because picante::pd()
-	needs column names that are not generated in nullmodel(). 
+	current confusing one. The changes were trickered when testing
+	picante::pd().
 
 	* protest: huge speed-up. Instead of calling procrustes() in every
 	permutation step, we only calculate the goodness of fit statistic

Modified: pkg/vegan/man/oecosimu.Rd
===================================================================
--- pkg/vegan/man/oecosimu.Rd	2013-01-31 13:48:28 UTC (rev 2399)
+++ pkg/vegan/man/oecosimu.Rd	2013-02-02 07:31:03 UTC (rev 2400)
@@ -164,13 +164,22 @@
 }
 
 \value{ 
-  Function \code{oecosimu} returns the result of \code{nestfun} added
-  with a component called \code{oecosimu}. The \code{oecosimu}
-  component contains the simulated values of the statistic (item
-  \code{simulated}), the name of the \code{method}, \eqn{P} value
-  (with given \code{alternative}), \eqn{z}-value of the statistic
-  based on simulation (also known as standardized effect size), and
-  the mean of simulations.  
+
+  Function \code{oecosimu} returns an object of class
+  \code{"oecosimu"}.  The result object has items \code{statistic} and
+  \code{oecosimu}.  The \code{statistic} contains the complete object
+  returned by \code{nestedfun} for the original data.  The
+  \code{oecosimu} component contains the following items:
+  \item{statistic}{Observed values of the statistic.}
+  \item{simulated}{Simulated values of the statistic.}
+  \item{means}{Mean values of the statistic from simulations.}
+  \item{z}{\eqn{z}-values or the standardized effect sizes of the observed 
+     statistic based on simulations.}
+  \item{pval}{The \eqn{P}-values of the statistic based on simulations.}
+  \item{alternative}{The type of testing as given in argument \code{alternative}.}
+  \item{method}{The \code{method} used in \code{\link{nullmodel}}.}
+  \item{isSeq}{\code{TRUE} if \code{method} was sequential.}
+
 }
 
 \references{



More information about the Vegan-commits mailing list