Open In App

Interactive() Function in R

Last Updated : 02 Jun, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

In this article, we are going to see interactive() Function in R Programming Language.

Interactive() Function 

It returns TRUE when R is being used interactively and FALSE otherwise. This function is used to test whether R runs interactively or not.

Syntax: interactive()  

It will return TRUE, if is running interactively, otherwise FALSE.

Example 1:

Check whether the environment is Running interactively or not.

R




interactive()


Output:

TRUE

Example 2:

Check whether the environment is Running interactively or not by creating two vectors and display them

R




# vector1
vec1 = c(2,3,4)
  
# vector2
vec2 = c(2,1,2,3)
  
# display
print(vec1)
print(vec2)
  
# check for interactivity
interactive()


Output:

[1] 2 3 4
[1] 2 1 2 3
[1] TRUE

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads