ID EN
Miscellaneous

deparseOpts

R Base 3.6.2

Process the deparsing options for deparse, dput and dump.

Syntax

R
.deparseOpts(control)<p></p><p>..deparseOpts</p>

Arguments

Parameter Description
control character vector of deparsing options.

Return Value

An integer value corresponding to the control options selected.

Details

..deparseOpts is the character vector of possible deparsing options used by .deparseOpts(). .deparseOpts() is called by deparse, dput and dump to process their control argument. The control argument is a vector containing zero or more of the following strings (exactly those in ..deparseOpts). Partial string matching is used. "keepInteger":Either surround integer vectors by as.integer() or use suffix L, so they are not converted to type double when parsed. This includes making sure that integer NAs are preserved (via NA_integer_ if there are no non-NA values in the vector, unless "S_compatible" is set). "quoteExpressions":Surround unevaluated expressions, but not formulas, with quote(), so they are not evaluated when re-parsed. "showAttributes":If the object has attributes (other than a sou

Examples

Example
R
# NOT RUN {
(iOpt.all <- .deparseOpts("all")) # a four digit integer

## one integer --> vector binary bits
int2bits <- function(x, base = 2L,
                     ndigits = 1 + floor(1e-9 + log(max(x,1), base))) {
    r <- numeric(ndigits)
    for (i in ndigits:1) {
        r[i] <- x%%base
        if (i > 1L)
            x <- x%/%base
    }
    rev(r) # smallest bit at left
}
int2bits(iOpt.all)
## what options does  "all" contain ?
(oa <- ..deparseOpts[-1][int2bits(iOpt.all) == 1])
stopifnot(identical(iOpt.all, .deparseOpts(oa)))
# }