Handling ‘+’ Sign in R Prompt / RStudio Console
In this R tutorial you’ll learn how to deal with a + sign in the RStudio console.
The post consists of two examples for the handling of + signs in the prompt. To be more specific, the page is structured as follows:
Let’s just jump right in!
Example 1: Why does the + Sign Appear in the RStudio Console & How to End It
Example 1 explains why the + sign appears in the RStudio console and how to end it.
Let’s assume that we want to calculate the mean of a numeric vector. Then, we might try to use the mean function as shown below:
mean(1:5 # Function is not closed properly # > mean(1:5 # +
Unfortunately, this didn’t work. The R prompt shows a plus sign and no result is returned.
The reason for this is that we didn’t properly close the function call with closed parentheses (i.e. “)”).
In this example this might look obvious, but in practice this is a very typical problem when it comes to more complex user-defined functions or to if and else statements.
So how can we end the unfinished function call in R or RStudio? For this, we simply have to press Esc on the keyboard.
Example 2: Execute R Code without Showing + Sign in Console
After ending the + sign in the R prompt using the Escape key, we have to work over the R code we have executed before. In our simplified example we just have to add a closed bracket to our code:
mean(1:5) # Function is closed properly #  3
Video & Further Resources
Would you like to learn more about the RStudio console? Then I recommend watching the following video of my YouTube channel. In the video, I’m explaining the R programming code of the present article.
The YouTube video will be added soon.
In addition, you may read the other articles of my website:
This page has illustrated how to end a plus sign in the R prompt in the R programming language. Let me know in the comments, if you have further questions.