[Analogue-commits] r225 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Aug 23 10:43:33 CEST 2011


Author: gsimpson
Date: 2011-08-23 10:43:33 +0200 (Tue, 23 Aug 2011)
New Revision: 225

Modified:
   pkg/R/print.performance.R
Log:
extend the print method to handle performance methods that return a matrix of measures (i.e. a set of performance statistics for each axis in PCR)

Modified: pkg/R/print.performance.R
===================================================================
--- pkg/R/print.performance.R	2011-08-23 08:41:48 UTC (rev 224)
+++ pkg/R/print.performance.R	2011-08-23 08:43:33 UTC (rev 225)
@@ -1,8 +1,13 @@
-`print.performance` <- function(x, ...) {
+`print.performance` <- function(x, digits = min(getOption("digits"), 4),
+                                ...) {
     CV.method <- attr(x, "CV.method")
-    perf.names <- names(x)
-    attributes(x) <- NULL
-    names(x) <- perf.names
-    print.default(round(x, 4), ...)
+    if(inherits(x, "data.frame")) {
+        print.data.frame(x, digits = digits, ...)
+    } else {
+        perf.names <- names(x)
+        attributes(x) <- NULL
+        names(x) <- perf.names
+        print.default(x, digits = digits, ...) # x was round(x, 4)
+    }
     invisible(x)
 }



More information about the Analogue-commits mailing list