interactive() Function in R (Example) | Test if R is Running Interactively


This tutorial shows how to check whether R runs interactively using the interactive function in the R programming language.

The tutorial contains the following:

Let’s take a look at some R codes in action.


Example: Test if R is Running Interactively Using interactive() Function

This example explains how to test whether an R session is interactive, i.e. it is assumed that the current R session is one in which is a human operator to interact with.

For this, we can simply execute the interactive command as shown below:

interactive()                     # Apply interactive function
# [1] TRUE

The previous R code has returned the logical indicator TRUE, i.e. it is assumed that a human is there to, for instance, conduct corrections to incorrect input.


Video & Further Resources

I have recently published a video on my YouTube channel, which shows the examples of this tutorial. Please find the video below:


The YouTube video will be added soon.


In addition, you may read the related posts on my website. You can find a selection of related articles below.


Summary: You have learned in this article how to apply the interactive function in the R programming language. Don’t hesitate to let me know in the comments section, if you have further questions. In addition, please subscribe to my email newsletter to receive updates on new posts.


Subscribe to the Statistics Globe Newsletter

Get regular updates on the latest tutorials, offers & news at Statistics Globe.
I hate spam & you may opt out anytime: Privacy Policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.