Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suppress output of a function

Tags:

r

I'm looking to suppress the output of one command (in this case, the apply function).

Is it possible to do this without using sink()? I've found the described solution below, but would like to do this in one line if possible.

How to suppress output

like image 443
Tor Avatar asked Apr 27 '10 16:04

Tor


People also ask

Which command is used to suppress the output?

Hear me out here, I know that to suppress output you put a semicolon at the end of a line. However even after adding the semicolon at the end of each line of my .

How do you suppress in MATLAB?

Accepted Answer The possibility to suppress the screen output of a script via switch is not available in MATLAB. To work around this issue, you could do the following: 1) To disable the display of any figure windows you can use the MATLAB startup option "-noFigureWindows".


1 Answers

It isn't clear why you want to do this without sink, but you can wrap any commands in the invisible() function and it will suppress the output. For instance:

1:10 # prints output invisible(1:10) # hides it 

Otherwise, you can always combine things into one line with a semicolon and parentheses:

{ sink("/dev/null"); ....; sink(); } 
like image 89
Shane Avatar answered Oct 13 '22 22:10

Shane