invisible
Mark Value as Non-Printing

Description

Suppresses printing an object.

Usage

invisible(x)

Arguments

x any object. If not specified, NULL is assumed.

Details

This function temporarily suppresses the printing of an object. Invisibility is lost if any other expression is evaluated between the call to invisible and the point where the invisible object is returned to the top level. The withVisible function returns an expression value along with whether it is visible.
Value
returns x.
See Also
print, withVisible.
Examples
1:5
# prints [1] 1 2 3 4 5

invisible(1:5) # doesn't print anything

xx <- function(x,y) x+y xx(1,2) # prints [1] 3

xx <- function(x,y) invisible(x+y) xx(1,2) # doesn't print anything

xx <- function(x,y) invisible(x)+invisible(y) xx(1,2) # prints [1] 3 # because the "+" operation clears invisibility

xx <- function(x,y) x<-y xx(1,2) # doesn't print anything # because assignment is invisible

xx <- function(x,y) (x<-y) xx(1,2) # prints [1] 2 # because parentheses around assignment clears invisiblity

Package base version 6.1.4-13
Package Index