What does the "+" symbol mean on the left side of the R console?

79k Views Asked by At

I have entered in code to plot a graph, but when I press Enter to execute the graph, it does not plot the graph. Rather, + symbols appear every time I press Enter to execute the command and plot the code. Now there is a long column of + symbols in my R consoles.

Why is this happening and what can I do to prevent this from happening?

2

There are 2 best solutions below

0
On

The prompt has + because it signifies that the prompt is expecting more from the line of code, a sort of continuation. This may be because you forgot to close something so the prompt expects the closing side. For example, say you forgot to close a string like so:

> "
+
+

Here, I entered a double-quote into the prompt and kept on pressing Enter. There is a missing double-quote to tell the prompt I've ended the string literal, so the prompt expects another double-quote. Once you enter the double quote the prompt will stop expecting it. For example:

> "
+
+ "
[1] "\n\n"

This is standard on all command prompts, to expect more code if something isn't ended properly, like the string literal above. Check your code to make sure you've closed all opening quotes, symbols, etc, so the prompt doesn't expect it and your code executes correctly.

The ways of exiting the prompt when this happens are:

  • Esc on RGui and RStudio
  • Ctrl-C on Terminals and Command Prompts
0
On

This could happen if you used space in the middle of an object name, eg. Column names. R doesn't allow space in between " ".