Herman Toothrot
Herman Toothrot

Reputation: 1533

paste single line command in R console without executing

Since I have started using R I have noticed inconsistent behaviours when pasting a complete single command line in the R GUI console. Sometimes the command is executed, sometime is not. I tried to use the "paste commands only" but the command is still executed and the option does not seem to have any effect. I want to past a complete command and not execute it.

How do I control what happens when I paste a single line?

EDIT: i think the issue is that I am also copying from notepad the "enter" character, so that's what make the command run right away. Is there a way to avoid this?

Upvotes: 3

Views: 2024

Answers (1)

Joshua Ulrich
Joshua Ulrich

Reputation: 176648

If you do not copy a newline character at the end of the command, it will not be executed when you paste it. You will need to enter one manually.

Rather than copy/paste, you might want to use an editor where you can highlight the code you want to run and then send it to the R console via a button or shortcut key. The Windows R GUI has this feature, as does Rstudio.

Upvotes: 3

Related Questions