tags:

views:

152

answers:

2

I often run long R scripts when I start my R environment. I would like to be able to load / run the R script in Emacs / ESS and continue other work in another buffer.

When I press C-g or C-c C-c the process is interrupted, and I must restart the script.

What is the best way to background the R process in ESS / Emacs?

EDIT: Thank you for your answers and comments, but none of them address the fact that Emacs freezes when you load / run a large script and you can't change buffer.

I suppose my question is a little more general - can Emacs background a process to let you keep working?

+1  A: 

M-x R will start an R session (the default buffer name is *R*). If your press M-x R again, a second R session will be started (with buffer name *R:2*).

Each session has its own R process, so you can run a long R script in one and still use the other independently.

Pressing C-x C-b brings up the buffer list, which would allow you to switch between R sessions.

Or, if you put

(global-set-key "\C-cr" 'ess-request-a-process)

in your .emacs initialization file, then every time you press C-c r you will be prompted for which R session (buffer) you wish to switch to. If you only have one session, it will switch there automatically.

unutbu
A: 

In my personal experience, ESS isn't very good at handling very large scripts, in that at times the rest of Emacs becomes unusable. Perhaps you are better off doing development in ESS, then running the full script in BATCH mode.

stevejb