[Distr-commits] r552 - in branches/distr-2.2/pkg/distrMod: R chm

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Aug 26 02:56:12 CEST 2009


Author: ruckdeschel
Date: 2009-08-26 02:56:12 +0200 (Wed, 26 Aug 2009)
New Revision: 552

Modified:
   branches/distr-2.2/pkg/distrMod/R/0distrModUtils.R
   branches/distr-2.2/pkg/distrMod/chm/distrMod.chm
Log:
+distrMod: yet another issue with "pretty printing", last commit did not help; instead give default names "" if empty

Modified: branches/distr-2.2/pkg/distrMod/R/0distrModUtils.R
===================================================================
--- branches/distr-2.2/pkg/distrMod/R/0distrModUtils.R	2009-08-25 22:49:21 UTC (rev 551)
+++ branches/distr-2.2/pkg/distrMod/R/0distrModUtils.R	2009-08-26 00:56:12 UTC (rev 552)
@@ -34,20 +34,21 @@
 }
 
 .show.with.sd <- function(est, s){
-        est <- as.numeric(est); dim(est) <- NULL
-        s <- as.numeric(s); dim(s) <- NULL
+#        est <- as.numeric(est); dim(est) <- NULL
+#        s <- as.numeric(s); dim(s) <- NULL
+        if(is.null(names(est))) names(est) <- rep("", length.out=length(est))
   ### code borrowed from print.fitdistr in  package MASS by B.D. Ripley
         digits <- getOption("digits")
         ans <- format(base::rbind(est, s), digits=digits)
-        ans[1, ] <- sapply(ans[1, ], function(x) paste("", x))
-        ans[2, ] <- sapply(ans[2, ], function(x) paste("(", x, ")", sep=""))
+        ans[1L, ] <- sapply(ans[1L, ], function(x) paste("", x))
+        ans[2L, ] <- sapply(ans[2L, ], function(x) paste("(", x, ")", sep=""))
      ## only used for digits
         dn <- dimnames(ans)
-        dn[[1]] <- rep("", 2)
-        dn[[2]] <- paste(substring("      ", 1, 
-                       (nchar(ans[2,]) - nchar(dn[[2]])) %/% 2), dn[[2]])
-        dn[[2]] <- paste(dn[[2]], substring("      ", 1, 
-                       (nchar(ans[2,]) - nchar(dn[[2]])) %/% 2))
+        dn[[1L]] <- rep("", 2L)
+        dn[[2L]] <- paste(substring("      ", 1L,
+                       (nchar(ans[2L,]) - nchar(dn[[2L]])) %/% 2), dn[[2L]])
+        dn[[2L]] <- paste(dn[[2L]], substring("      ", 1L,
+                       (nchar(ans[2L,]) - nchar(dn[[2L]])) %/% 2))
         dimnames(ans) <- dn
         print(ans, quote = FALSE)
         return(invisible())

Modified: branches/distr-2.2/pkg/distrMod/chm/distrMod.chm
===================================================================
(Binary files differ)



More information about the Distr-commits mailing list