Integrate R with UEStudio / UltraEdit

Integrate R with UEStudio / UltraEdit

8
NewbieNewbie
8

    Jun 27, 2007#1

    I use R (http://www.r-project.org) for coding statistical analyses. How do I set up UE to send a line of code, or a selection, or the whole file to the R console?

    Thanks!

    262
    MasterMaster
    262

      Jun 27, 2007#2

      First you will need a good knowledge on how to invoke R from a command line prompt (command line options and such).

      Then be sure to have "advanced menus" activated in UE. (right click in the menu line and check "advanced" if needed).

      Then choose Advanced - Tool configuration...

      Then hit F1 (help) and read about the possibilities for setting up R as a User Tool and which dynamic parameters UE can deliver to you like %F - full path and filename and/or %sel% - selected text.

      Also study the power tip on Creating User and Project Tools...

      Hope it got you started.

      8
      NewbieNewbie
      8

        Jun 27, 2007#3

        I know how to do this from within UE, but I don't know how to invoke the R console to execute things on the clipboard or single lines from the editor. Has anyone out there figured out how to do this?

        9

          Aug 27, 2007#4

          Hi

          I use R for my statistic calculations. I was wondering if it is possible to send a line from UE to R (there is a thread on this in UEStudio but no helpful reply). The idea is that R is open all the time (so I don't want to start R everytime I send something from UE to R). Emacs has this option (ESS: Emacs Speaks Statistics).

          Renger

            Sep 25, 2007#5

            Nobody seems to use R and UE together (the more natural choice would probably be R and Emacs).
            I now can start R and UE opens automatically. R can use DDE, but there is not much about DDE in the manual of UE. Can I use DDE to copy a selection in a text file in UE to R using DDE and if yes, how to do this?

            2
            NewbieNewbie
            2

              Integrate Executable R in UltraEdit

              Apr 25, 2008#6

              Hi,

              How do I integrate R with UltraEdit such that I may run single lines, blocks or full files of code in R from UltraEdit. This is something I do easily from Emacs, but I want to be able to do it from UltraEdit. I tried configuring a tool using "%f" and "%sel%", but I am getting errors in both cases. I found this topic, but the suggestion was only to configure a tool. If anyone might provide more specific instructions, that would be very much appreciated by this new user! Thanks very much.

              Rob

              8
              NewbieNewbie
              8

                Mar 20, 2009#7

                Wow! 2 years ago! You're right: not much interest in using R & UE.
                UE is my preference too and I'm a beginner with R.
                Did you ever find out any more about this or did you give up and switch to another editor.

                2
                NewbieNewbie
                2

                  May 14, 2010#8

                  Hi,

                  I inquired about this problem two years ago and after trying yet again to figure this out, am not having any success. Did anyone figure this out? Thanks.

                  Rob

                  8
                  NewbieNewbie
                  8

                    May 14, 2010#9

                    I have never heard anything since then. I use Tinn-R (search sourceforge) for R development... UE is much better basic platform, but they haven't made any moves toward supporting R.

                    -86

                    2
                    NewbieNewbie
                    2

                      May 26, 2010#10

                      Hello,

                      I have just started using R. Working with SPSS and Stata integrated in UE for many years. Made my own tools for the integration of UE and both statistical programs. Selecting a line or a block of lines and launch them in the statistical program. Just the touch of a key will start invoking the lines.

                      The macro in UE has the commands:

                      InsertMode
                      ColumnModeOff
                      HexOff
                      UltraEditReOn
                      IfExtIs "do"
                      Copy
                      Open "<here is a standard temporary file for pasting the selection>"
                      SelectAll 'select the previous file content in the temporary file'
                      Paste 'paste the new content of the selected lines into replacing UE previous file content'
                      CloseFile Save
                      RunTool "StataAutoIt_file" 'this is an executable I wrote with the help of Scite (open source)'
                      Else 'if the extension is *.sps'
                      ClearClipboard
                      Copy
                      RunTool "Spss" 'this tool starts an executable written in Scite to lauch a *.sps= not working in SPSS 17 anymore, I still have not found a solution for that'
                      EndIf

                      The comments (green text) must be removed before the macro code is copied and pasted next into the edit macro dialog.

                      Amazing that so few people are interested in this very convenient tool. So keep up the spirit!

                      3
                      NewbieNewbie
                      3

                        May 28, 2010#11

                        Maybe we can grope our way toward a satisfactory solution.

                        In the tool configuration, the command line

                        G:\R-2.10.1\bin\Rscript.exe "%f"

                        Will send a script file to R and if "Capture output" is selected will send the results to the output window.

                        It will also work as a DOS command.

                        A tool configuration with

                        G:\R-2.10.1\bin\Rscript.exe --save --restore -e "%sel%"

                        Will let you select one line at a time and send the results to the output window.

                        A macro or script could be written to select a line automatically and send it to R, I would think.

                        The above send plots to a file as a PDF or whatever. What I haven't figured out is how to send R code to RGui or elsewhere and interactively view plots, etc. as you can with other editors.

                        I haven't investigated this deeply, so if anyone can suggest better/other ways to accomplish this, I'm all ears.

                        2
                        NewbieNewbie
                        2

                          Integrate R, SPSS17 and Stata with UltraEdit

                          Jun 02, 2010#12

                          Hi all,

                          I have programmed a solution for sending lines of syntax in a SPSS, Stata, or R files that are in my project group of files. For all of them one macro will do and suit all: do whatever you are used to do in the script files of all these programs, but now while you are working in your UE project.
                          A macro statement copies the selected text to a dummy.* file and then launches this file in the correct (opened) statistical software program.

                          These are the the lines in the macro whereby the comments (green text) must be removed before copying the macro code and pasting it next into edit macro dialog:

                          IfExtIs "do" ' if the section is in a Stata syntax file open in UE then '
                          Copy ' copy the lines you selected to launch( your line could be to launch another syntax file too) '
                          Open "<././open dummy.do>"
                          SelectAll
                          Delete ' remove previous lines in dummy '
                          Paste ' put new script lines '
                          CloseFile Save
                          RunTool "StataAutoIt_file" ' a file written in Scite: try it with SciTE\ScriptWriter\AU3Record.exe to program your own, '
                          ' http://www.scintilla.org/SciTEDownload.html IT IS NOT THAT DIFFICULT '

                          EndIf
                          IfExtIs "R" ' same trick as previous if the file is a *.R file open in UE '
                          ClearClipboard
                          Copy
                          RunTool "R_AutoIt" ' if you want to use RGUI as a default, no problem: just change the Scite to select the appropriate window '
                          EndIf
                          IfExtIs "sps" ' for SPSS17 a little bit of other trick has to be used: open your SPSS with the switch to the dummy.spss file '
                          ' = SPSS.exe" "././dummy.sps" in your shortcut on the desktop '

                          Copy ' same procedure: delete old lines in dummy.sps '
                          RunTool "Spss_AutoIt" ' in the Scite script is the paste command to work properly '
                          EndIf
                          ExitMacro

                          Possibly I am going to add the SAS procedure too.

                          If someone is interested in the Scites.au3, just let me know. And don't forget: 1 key on the keyboard does it all!

                          8
                          NewbieNewbie
                          8

                            Oct 13, 2010#13

                            Still waiting... Anyone found any solutions?

                            901
                            MasterMaster
                            901

                              Oct 13, 2010#14

                              What exactly are you waiting for?

                              jorrasdk already mentioned what needs to be done three years ago, and psycop and lascasas both offered ideas. That is what a user-to-user forum is for... to collaborate with other users to find a workable solution.

                              Regarding UE, you'll never be able to execute code directly from within the editor. UE is a text editor, not an IDE. Configuring a user tool as jorrasdk suggested is the only way.

                              Regarding UES, I don't use it and don't really know what is possible. In general, you're not likely to see anything language-specific added to UES by the developers unless there is sufficient demand for the functionality from a sizable cross-section of the product's user base. You certainly won't see changes to the product as the result of posts in this forum. IDM does not monitor the user-to-user forums.

                              8
                              NewbieNewbie
                              8

                                Jan 05, 2011#15

                                re. "What exactly are you waiting for?"

                                Well, gosh, something that made interfacing R & UE or UES a bit more straightforward. :D

                                I'm pleased to see that since I last checked this thread- ~11 months ago-some nice suggestions from psycop and lascasas have appeared. For me these are positive, but more in the nature of "groping our way" as lascasas noted. psycop's macro makes me hopeful because it shows that a solution is indeed possible! , but it is a little too rough for my abilities & time I believe:
                                a) his "lines in the macro" includes urls and comments and I'm not clear that I can execute it as is.
                                b) the strategy requires installing & using SciTE and possibly something called scintilla (and is the AutoIt utility also required? and I believe some additional macro file which is not presented) none of which I'm familiar with. I accept it may be "NOT THAT DIFFICULT" but I don't have time to learn all that new stuff just now. Plus
                                c) SciTE I believe works on win32 & gtk and actually I returned to check this thread partly because-with the advent of UE for OS X-interfacing UE with R would make my life easier in using R on both win & os x.

                                For now, I use Tinn-R on windows & the built-in editor on os x--and on either platform if I have any difficult code or something I'm struggling to keep straight it is not that difficult to edit it in UE, save it, and not worry about submitting it interactively to the rgui. Fortunately, e.g., UE and Tinn-R coexist pretty benignly. The available Tinn-R and os x tools are okay, but I'm just more comfortable with the loving embrace of UE. :D And if it were necessary I'd gladly upgrade to UES if that did the trick.

                                What I wonder about for the future, is if something like the "svSocket Package" for R (which is used to help interface Tinn-R to R) could be of use in interfacing UE. Seems so simple: at a minimum we mainly need to send a marked block or an entire file to rgui, right? I've interfaced UE with some other mathematical modeling systems, but I don't get it with rgui. The svSocket pdf documents seem to offer a solution, but I don't understand how to interface a random text editor. As one of the authors of svSocket states: its primary use ... "is the communication engine between the client (a code editor, or IDE program like Komodo Edit) and server (R)." (http://r.789695.n4.nabble.com/Video-dem ... 93671.html) However I don't see anything in the UE/UES manual about sending text to a socket and this is getting beyond my technical knowledge. It may be that a socket is called by another name or otherwise simple, but I don't see how to do it. The other reason I mention svSocket it that it can be added to R on both windows and os x platforms.

                                For now, I continue using UE when I really need it. I guess the reasons this isn't on the priority list of more clever folks than I is a) using UE with R is kinda workable as is, and
                                b) "real R users" use EMACS/ESS :D :D but I sadly just don't have a history of using EMACS :D

                                Thanks again to psycop and lascasas & everybody for moving this along a bit.

                                Read more posts (7 remaining)