[Vegan-commits] r388 - in pkg: R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jun 3 21:50:41 CEST 2008


Author: jarioksa
Date: 2008-06-03 21:50:41 +0200 (Tue, 03 Jun 2008)
New Revision: 388

Added:
   pkg/R/print.mso.R
Modified:
   pkg/R/mso.R
   pkg/inst/ChangeLog
   pkg/man/mso.Rd
Log:
mso got a print method and learnt about its own call

Modified: pkg/R/mso.R
===================================================================
--- pkg/R/mso.R	2008-06-03 08:04:24 UTC (rev 387)
+++ pkg/R/mso.R	2008-06-03 19:50:41 UTC (rev 388)
@@ -1,6 +1,11 @@
-mso <- function (object.cca, object.xy, grain = 1, round.up = FALSE,
-                 permutations = FALSE) 
+`mso` <-
+    function (object.cca, object.xy, grain = 1, round.up = FALSE,
+              permutations = FALSE) 
 {
+    if (inherits(object.cca, "mso")) {
+        rm <- which(class(object.cca) == "mso")
+        class(object.cca) <- class(object.cca)[-rm]
+    }
     object <- object.cca
     xy <- object.xy
     N <- nrow(object$CA$Xbar)
@@ -12,7 +17,7 @@
         H <- ceiling(Dist/grain) * grain
     else H <- round(Dist/grain) * grain
     hmax <- round((max(Dist)/2)/grain) *grain
-	  H[H > hmax] <- max(H)
+    H[H > hmax] <- max(H)
     object$H <- H
     H <- as.vector(H)
     Dist <- sapply(split(Dist, H), mean)
@@ -72,6 +77,8 @@
         object$vario$CA.signif <- apply((perm >= matrix(statistic, 
                                          nrow(perm), ncol(perm)))/permutations, 1, sum)
     }
+    object$call <- match.call()
     class(object) <- c("mso", class(object))
     object
 }
+

Added: pkg/R/print.mso.R
===================================================================
--- pkg/R/print.mso.R	                        (rev 0)
+++ pkg/R/print.mso.R	2008-06-03 19:50:41 UTC (rev 388)
@@ -0,0 +1,9 @@
+`print.mso` <-
+    function(x,  digits = max(3, getOption("digits") - 3), ...)
+{
+    NextMethod(x, "print", ...)
+    cat("mso variogram:\n\n")
+    print(x$vario, digits = digits, ...)
+    invisible(x)
+}
+

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2008-06-03 08:04:24 UTC (rev 387)
+++ pkg/inst/ChangeLog	2008-06-03 19:50:41 UTC (rev 388)
@@ -10,8 +10,11 @@
 	the maximum distance into a single distance class.
 
 	* mso: plot.mso renamed to msoplot so that plot.cca also works,
-	and the example uses now Oribatid mite data set.
+	and the example uses now Oribatid mite data set. 
 
+	* mso: gained a print method that also shows the variogram
+	(Helene, please check this!), and mso knows about its own call. 
+
 	* lines.spantree: did not pass graphical arguments to lines
 	(broken in 1.12-15).
 

Modified: pkg/man/mso.Rd
===================================================================
--- pkg/man/mso.Rd	2008-06-03 08:04:24 UTC (rev 387)
+++ pkg/man/mso.Rd	2008-06-03 19:50:41 UTC (rev 388)
@@ -1,5 +1,6 @@
 \name{mso}
 \alias{mso}
+\alias{print.mso}
 \alias{msoplot}
 
 \title{ Functions for performing and displaying a spatial partitioning



More information about the Vegan-commits mailing list