Many people, including myself, might not like editing .r (source) files in R itself. Therefore I present you a very ingenious way of avoiding this.

“NppToR provides R language syntax highlighting, code folding, and auto-completion to Notepad++. In addition, it provides Rgui style code passing between Notepad++ and the Rgui.”

To use NppToR the first step is to download and install R. Secondly, we dowload and install notepad++. Finally, we download and install NppToR.

Open NppToR by clicking on  . In the settings window we can see/edit which hot-keys to use and adjust a few thing.

An .r file in notepadd++ now look like

nppToR Code Snippet

nppToR Code Snippet (Series Problem)

Passing it to R ( F8 (lines), ^F8 (file) ) results in the following

nppToR Console

nppToR code passing

My friend Alexander, pointed out that writing R code is even easier (and more fancy) when editing in Komodo (in combination with SciViews-K). I may come back to that later!

7 comments so far

Add Your Comment
  1. Tom

    An important detail!!! The settings ter is referring to is not the N++ settings menu, but the nppToR settings menu. For me it’s found by right clicking on the tray icon in the bottom right.

  2. Jared

    I have Notepad++ and NppToR installed. Let’s say I have an R session open which has all my stuff in it, then I open Notepad++ and my code file. I hit “F8” and it opens a new R session, pasting the code in. All subsequent “F8″‘s will paste the code into that session also.

    How do I get the code to paste into that first R session I already had open?

  3. tersmitten

    I have no idea. Maybe you could have a look at this forum. I will investigate too.

  4. tersmitten

    Maybe you could play with the “R cmd line parameters” under settings?

  5. Jared

    I read somewhere else that it might be a Windows 7 issue, but no one has issued a fix or anything.

  6. Adrian

    I know that the question was asked over 3 years ago, but perhaps someone will come across this post looking for the answer.
    As tersmitten hinted, add “–sdi” to the command line parameters.
    NppToR will then send R code to the active R window

  7. Pd

    Do not open the R session. AFter you install NppToR you will have NppToR app in your windows. Click on that. it will open NPP. Write some R code and hit F8. It should open R session and will run the code that you trying to run.