Mark Function as Non-Printing

DESCRIPTION:

Insures that an object will not be printed.

USAGE:

invisible(x=NULL)
passAlongInvisibility(expr)

ARGUMENTS:

expr
a S-PLUS expression, generally a function call.

OPTIONAL ARGUMENTS:

x
any S-PLUS object.

VALUE:

x .

SIDE EFFECTS:

the function invisible reaches back 2 frames and sets a special flag, .Auto.print, to FALSE. This has the effect of preventing automatic printing if the function calling invisible was called from the top level since .Auto.print in frame 1 is set to FALSE.

DETAILS:

If a function wants to return an invisible value if the function itcalls does so, it can use passAlongInvisibility(func(x)), as in the checking example below.

SEE ALSO:

.

EXAMPLES:

function(x, y=log(x)) {
        plot(x,y)
        invisible(list(x,y)) # return a value invisibly
}
histPositive <- function(x,...) {
        passAlongInvisibility(hist(x[x>0],...)) # mimic hist's invisibility
}
histPositive((-5):5, plot=F) # visible result
histPositive((-5):5, plot=T) # invisible result