Skip to content

Commit

Permalink
don't write p-value = < 2e-16 (with linebreak inside)
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/trunk@28229 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
maechler committed Feb 3, 2004
1 parent 375d7b5 commit dc24f3e
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions src/library/stats/R/htest.R
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
print.htest <-
function(x, digits = 4, quote = TRUE, prefix = "", ...)
print.htest <- function(x, digits = 4, quote = TRUE, prefix = "", ...)
{
cat("\n")
writeLines(strwrap(x$method, prefix = "\t"))
cat("\n")
cat("data: ", x$data.name, "\n")
out <- character()
if(!is.null(x$statistic))
out <- c(out, paste(names(x$statistic), "=",
format(round(x$statistic, 4))))
out <- c(out, paste(names(x$statistic), "=",
format(round(x$statistic, 4))))
if(!is.null(x$parameter))
out <- c(out, paste(names(x$parameter), "=",
format(round(x$parameter, 3))))
if(!is.null(x$p.value))
out <- c(out, paste("p-value =",
format.pval(x$p.value, digits = digits)))
out <- c(out, paste(names(x$parameter), "=",
format(round(x$parameter, 3))))
if(!is.null(x$p.value)) {
fp <- format.pval(x$p.value, digits = digits)
out <- c(out, paste("p-value",
if(substr(fp,1,1) == "<") fp else paste("=",fp)))
}
writeLines(strwrap(paste(out, collapse = ", ")))
if(!is.null(x$alternative)) {
cat("alternative hypothesis: ")
cat("alternative hypothesis: ")
if(!is.null(x$null.value)) {
if(length(x$null.value) == 1) {
alt.char <-
switch(x$alternative,
two.sided = "not equal to",
less = "less than",
greater = "greater than")
alt.char <-
switch(x$alternative,
two.sided = "not equal to",
less = "less than",
greater = "greater than")
cat("true", names(x$null.value), "is", alt.char,
x$null.value, "\n")
x$null.value, "\n")
}
else {
cat(x$alternative, "\nnull values:\n")
Expand All @@ -38,7 +39,7 @@ function(x, digits = 4, quote = TRUE, prefix = "", ...)
if(!is.null(x$conf.int)) {
cat(format(100 * attr(x$conf.int, "conf.level")),
"percent confidence interval:\n",
format(c(x$conf.int[1], x$conf.int[2])), "\n")
format(c(x$conf.int[1], x$conf.int[2])), "\n")
}
if(!is.null(x$estimate)) {
cat("sample estimates:\n")
Expand Down

0 comments on commit dc24f3e

Please sign in to comment.