1

I, an R user, decided recently to try using Emacs-ESS combo. So far I have been work in a single-window mode (C-x 1) just for text highlighting.

Now I am trying split it in two windows (C-x 3) to work on an .R file in the left window, and have R execute the commands in the right window. Something like this: enter image description here

After selecting sections of code on the left, how can I "send" it as a command to the right? Essentially, I want the input to remain on on the left (so that I can incrementally build the code up) and the actual R output on (including error messages) the right.

2 Answers 2

2

Two good options:

ess-eval-region-or-function-or-paragraph vis (C-M-x): Sends the current selected region or function or paragraph.

ess-eval-region-or-function-or-paragraph-and-step (C-c C-c): Like ess-eval-region-or-function-or-paragraph but steps to next line of code.

Source: ESS manual.

Sign up to request clarification or add additional context in comments.

1 Comment

Is something different happening if this is done on an R script inside a package? I am running this and the command is sent to the buffer, but apparently not executed. The variable does not exist in the session. There are a few + surrounding the code which is not what I'm used to. This only seems to happen to scripts in package R/ folders.
1

You can also use: C-c-p to send a paragraph or region between two empty lines C-c-r to send a region that has been selected and is highlighted

I prefer this way because you only need to press the Ctrl key

there are normally many ways to send code to the R console. It will take you time to realize what is best for you, or you may eventually change the key bindings.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.