Configure fix () and edit () to open in Notepad ++ from R / RStudio

When I do this in RStudio or RGUI:

fix(SomeFunction) 

(or using edit() ), I see the function code in Notepad. Is there a way to change this so that the code preview is opened in Notepad ++, and not in the usual old Notepad? And similarly, is there anyway that I can get View(SomeDataFrame) to open in Excel?

+6
source share
2 answers

fix and edit functions invoke the editor defined in the "editor" argument.
By default, this argument has the value getOption('editor') , as shown in the documentation for editing functions .

Therefore, you can pass the notepad ++ path as an argument to a function, that is:

 path <- "C:\\Program Files (x86)\\Notepad++\\Notepad++.exe" fix(somefunction,editor=path) 

or set notepad ++ as the default editor by changing the R parameters for the current session, i.e.:

 path <- "C:\\Program Files (x86)\\Notepad++\\Notepad++.exe" options(editor=path) # from now on, all calls to fix and edit will open notepad++ as default editor... fix(somefunction) 

NB

If you want to set a new default parameter for all subsequent sessions, you must edit the Rprofile.site script in the RHome\etc path, as described here .

+7
source

You can try something like this to create a temporary CSV and open in Excel.

+5
source

All Articles