Open In App

Suppress Output of Command in R

Last Updated : 31 Aug, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

In this article, we are going to discuss how to suppress the output of a command in R programming language.

Suppressing means making the output invisible. We can make the output should not appear. By using invisible() function we can suppress the output.

Syntax:

invisible(variable_name)

Where variable_name is the name of the created variable

Example: R program to create a variable and make suppress

R




# create a string variable
a="hello geeks"
  
# suppress the output by using 
# invisible function
invisible(a)


Example: R program to create a vector, list, and dataframe and suppress the output

R




# create a vector of subjects
a=c("c","c++","java")
  
# suppress the vector output by using 
# invisible function
invisible(a)
  
# create a dataframe of subjects
b=data.frame("c","c++","java")
  
# suppress the dataframe output by using
# invisible function
invisible(b)
  
# create a list of subjects
c=list("c","c++","java")
  
# suppress the listoutput by using invisible 
# function
invisible(c)


For both the examples, no output will be generated, since the entire aim of this article is to suppress output.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads