wolfgang.lederer@stat.uni-muenchen.de
2005-Apr-21 13:36 UTC
[Rd] printCoefmat(signif.legend =FALSE) (PR#7802)
printCoefmat(signif.legend =FALSE) does not work properly. The option "signif.legend = FALSE" is ignored as shown in the example below. cmat <- cbind(rnorm(3, 10), sqrt(rchisq(3, 12))) cmat <- cbind(cmat, cmat[,1]/cmat[,2]) cmat <- cbind(cmat, 2*pnorm(-cmat[,3])) colnames(cmat) <- c("Estimate", "Std.Err", "Z value", "Pr(>z)") # Prints the legend, although it should not printCoefmat(cmat, signif.stars =TRUE, signif.legend = FALSE) # Estimate Std.Err Z value Pr(>z) #[1,] 10.3567 3.3680 3.0750 0.002105 ** #[2,] 9.1652 4.3609 2.1017 0.035581 * #[3,] 10.4420 3.6527 2.8587 0.004253 ** #--- #Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 # Does not print the legend, although it should printCoefmat(cmat, signif.stars = FALSE, signif.legend = TRUE) # Estimate Std.Err Z value Pr(>z) #[1,] 10.3567 3.3680 3.0750 0.002105 #[2,] 9.1652 4.3609 2.1017 0.035581 #[3,] 10.4420 3.6527 2.8587 0.004253 I think the problem can be easily solved by changing the code lines (3. and 4. from the bottom) if (signif.stars) cat("---\nSignif. codes: ", attr(Signif, "legend"), "\n") to if (signif.legend) cat("---\nSignif. codes: ", attr(Signif, "legend"), "\n") At least it works for the more sensibel case, that no legend should be produced. Regards Wolfgang --please do not edit the information below-- Version: platform = i386-pc-mingw32 arch = i386 os = mingw32 system = i386, mingw32 status major = 2 minor = 1.0 year = 2005 month = 04 day = 18 language = R Windows XP Professional (build 2600) Service Pack 2.0 Search Path: .GlobalEnv, package:simex, package:methods, package:stats, package:graphics, package:grDevices, package:utils, package:datasets, Autoloads, package:base ************************************************** Wolfgang Lederer Institut f?r Statistik Ludwig-Maximilians-Universit?t M?nchen Ludwigstra?e 33 D-80539 M?nchen Tel: +49 89 2180 3165 Fax: +49 89 2180 5308
ripley@stats.ox.ac.uk
2005-Apr-21 13:43 UTC
[Rd] printCoefmat(signif.legend =FALSE) (PR#7802)
On Thu, 21 Apr 2005 wolfgang.lederer@stat.uni-muenchen.de wrote:> printCoefmat(signif.legend =FALSE) does not work properly. The option > "signif.legend = FALSE" is ignored as shown in the example below. > > cmat <- cbind(rnorm(3, 10), sqrt(rchisq(3, 12))) > cmat <- cbind(cmat, cmat[,1]/cmat[,2]) > cmat <- cbind(cmat, 2*pnorm(-cmat[,3])) > colnames(cmat) <- c("Estimate", "Std.Err", "Z value", "Pr(>z)") > > # Prints the legend, although it should not > > printCoefmat(cmat, signif.stars =TRUE, signif.legend = FALSE) > # Estimate Std.Err Z value Pr(>z) > #[1,] 10.3567 3.3680 3.0750 0.002105 ** > #[2,] 9.1652 4.3609 2.1017 0.035581 * > #[3,] 10.4420 3.6527 2.8587 0.004253 ** > #--- > #Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > > # Does not print the legend, although it should > > printCoefmat(cmat, signif.stars = FALSE, signif.legend = TRUE) > # Estimate Std.Err Z value Pr(>z) > #[1,] 10.3567 3.3680 3.0750 0.002105 > #[2,] 9.1652 4.3609 2.1017 0.035581 > #[3,] 10.4420 3.6527 2.8587 0.004253 > > > I think the problem can be easily solved by changing the code lines (3. > and 4. from the bottom) > > if (signif.stars) > cat("---\nSignif. codes: ", attr(Signif, "legend"), "\n") > to > > if (signif.legend) > cat("---\nSignif. codes: ", attr(Signif, "legend"), "\n") > > At least it works for the more sensibel case, that no legend should be > produced.Probably if(signif.stars && signif.legend) would be most appropriate. -- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595