formatCoefmat: Format a coefficient table

Usage Arguments Examples

View source: R/fun.R

Usage

1
formatCoefmat(x, digits = 6, pdigits = digits - 1)

Arguments

x
digits
pdigits

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (x, digits = 6, pdigits = digits - 1) 
{
    pformat <- function(x, digits) {
        x <- format(xx <- round(x, digits))
        x[as.double(xx) == 0] <- paste(c("<.", rep("0", digits - 
            1), "1"), collapse = "")
        x
    }
    xx <- array("", dim = dim(x), dimnames = dimnames(x))
    for (i in 1:ncol(xx)) {
        xx[, i] <- format(round(x[, i], digits), digits = digits)
    }
    if (length(isp <- grep("^Pr\(", colnames(x))) > 0) {
        xx[, isp[1]] <- pformat(x[, isp[1]], digits = pdigits)
    }
    xx
  }

gmonette/spida documentation built on May 17, 2019, 7:25 a.m.