[Distr-commits] r351 - pkg/distrEx/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Nov 25 06:09:12 CET 2008


Author: stamats
Date: 2008-11-25 06:09:12 +0100 (Tue, 25 Nov 2008)
New Revision: 351

Modified:
   pkg/distrEx/R/AllShow.R
Log:
small changes to show methods ...

Modified: pkg/distrEx/R/AllShow.R
===================================================================
--- pkg/distrEx/R/AllShow.R	2008-11-25 04:55:48 UTC (rev 350)
+++ pkg/distrEx/R/AllShow.R	2008-11-25 05:09:12 UTC (rev 351)
@@ -1,12 +1,14 @@
 setMethod("show", "MultivariateDistribution",
     function(object){
-        cat(gettextf("Distribution object of class: %s\n", class(object)[1]))
+        txt <- gettextf("Distribution object of class: %s\n", class(object)[1])
         parameter <- param(object)
         Names <- slotNames(parameter)
         if(length(Names) > 1){
-          for(i in Names[Names != "name"])
-            cat(i, ": ", slot(parameter, i), "\n")
+            for(i in Names[Names != "name"])
+                txt <- c(txt,
+                    gettextf("%s: %s\n", i, slot(parameter, i)))
         }
+        return(txt)
     })
 setMethod("show", "EuclCondition",
     function(object){
@@ -22,13 +24,15 @@
     })
 setMethod("show", "UnivariateCondDistribution",
     function(object){
-        cat(gettextf("Distribution object of class: %s\n", class(object)[1]))
+        txt <- gettextf("Distribution object of class: %s\n", class(object)[1])
         parameter <- param(object)
         Names <- slotNames(parameter)
         if(length(Names) > 1){
-          for(i in Names[Names != "name"])
-            cat(i, ": ", slot(parameter, i), "\n")
+            for(i in Names[Names != "name"])
+                txt <- c(txt,
+                    gettextf("%s: %s\n", i, slot(parameter, i)))
         }
+        cat(txt)
         cat(gettext("## cond:\n"))
         show(object at cond)
     })



More information about the Distr-commits mailing list