Spaniel
Spaniel

Reputation: 367

Shortcut control enter does not work in R script

ctrl+R no longer works for executing script lines.

This is not a hardware/keyboard problem.

I have also restarted my PC.

I have tried on a different PC.

I have recently switched from using R to using RStudio. I thought this may have something to do with it, so I opened and resaved the script in RStudio, to no effect.

Furthermore, I have created an R-Project folder and have copied the files, including the script in question, into it. Then I started R-Studio and opened the project.

I would like to post my sessionInfo(), but do not know how to do that without executing the command.

Keep in mind that I only use R for stats purposes. I don't know much about informatics or other types of programming etc., so please try to keep it simple for me. Thanks!

Upvotes: 5

Views: 11536

Answers (2)

HBat
HBat

Reputation: 5702

In addition to the solution offered above, in Rstudio, Ctrl + Enter does not work if the chunk is broken in .Rmd files.

For example, if you press CTRL + Enter on the following line (2+2), it won't work:

```{r}
2+2
``

The chunk should end three Backtick characters, not two.

Upvotes: 18

Spaniel
Spaniel

Reputation: 367

The problem was that the script file (for some reason unkown to me) did not have the correct extension (.R). When I added that to the script file extension, it worked fine again.

Upvotes: 2

Related Questions