Author Topic: Support for R language  (Read 2141 times)

buggyfunbunny

  • Senior Community Member
  • Posts: 233
  • Hero Points: 4
Support for R language
« on: November 16, 2009, 02:54:17 AM »
Since I'll be returning to my stat roots next week by downloading R, support for that would be nice.  Since R is a OS version of S and S-Plus, you'd get those for free.  Would be a nice complement to SAS.  R, from what I read, is taking over the stat world, SAS possibly excepted.

tnet

  • Junior Community Member
  • Posts: 7
  • Hero Points: 1
Re: Support for R language
« Reply #1 on: November 18, 2009, 02:58:06 AM »
One (actually two) additional things on the wish list for features:

1.) language support for R script (syntax highlighting, braces, script beautify etc.)  I added .R to the extensions for SAS scripts and that works reasonably well, but perhaps we could even create tag files from the R installation directory/library tree.

(I don't know R as well as other languages, that's why I could use all the help I can get  :)   )


2.) Improved support for running R snippets (entire buffer or highlighted text) from within my favorite environment - Slickedit.

I used the Slick-C macro code I found on this site at: //http://community.slickedit.com/index.php?topic=5352.0 , and with tiny tweaks
created a version I called RunR.e that works reasonably well.  The code puts the currently selected R script code into a temporary file and pipes that to the rterm.exe executable (on windows), restoring the R environment before execution and saving the R environment afterwards.  This saves the state of variable assignments, datasets etc so you don't have to run all the R code preceding your current lines of interest (similar in operation to the default R GUI and Rcmdr TCL GUI). 

It seems the .RData file (the saved R workspace) gets created in the same directory as whatever is the current project's or file's directory in Slickedit.  It would be nice to have an option to find and delete the environment file (a save without load command flags to rterm.exe would do it) or an explicit deletion of the .RData file , but one can just delete it manually as desired to avoid making a science project out of this.



//From Re: Running a shell command and sending output to the build window
//        http://community.slickedit.com/index.php?topic=5352.0
_command void runR() //name_info (','VSARG2_READ_ONLY|VSARG2_REQUIRES_EDITORCTL)
{
  // reset a few things
   reset_next_error();
   clear_all_error_markers();
   clear_pbuffer ();


   activate_build ();
   // uncomment to clear build window
   // clear_pbuffer ();
   delete_file("c:\\temp\\tempRunR.r");
   put("c:\\temp\\tempRunR.r");

   
   _str cmdline="\"c:\\program files (x86)\\r\\r-2.9.1\\bin\\rterm.exe\" --restore --save < " :+ " " :+ maybe_quote_filename( "c:\\temp\\tempRunR.r") :+ " 2>&1";
   concur_command (cmdline, false, true, false, false);
   


}
 


tnet

  • Junior Community Member
  • Posts: 7
  • Hero Points: 1
Re: Support for R language
« Reply #2 on: January 05, 2010, 07:32:29 AM »
1.) Native support for editing, beautifying code and running R scripts from with Slickedit.  I hacked up slick-C macros to get by, but I'm still jumping into Xemacs to format/beautify code, and still grappling with Slickedit applying SAS editing rules to my R script code.

typical usage: highlight R script lines, hit f5 to run and view output in build window

R debugging would be beyond awesome.

2.) ability to run SQL by highlighting sql code and hitting F5, passing code to osql.exe or sqlcmd.exe with query results, if any pumped out to the build window or some other suitable window.  Also beautifying/formatting SQL code from within Slickedit.  (I currently use "SQL Pretty Printer which in turn uses the GSP General SQL Parser engine for that task.)

If it sounds like I'm trying to replace all Emacs capability with Slickedit equivialents, I am.  Slickedit is my "happy place".

Warm regards and thanks for making a great product I've been happily using for over 10 years.

Andrew

tnet

  • Junior Community Member
  • Posts: 7
  • Hero Points: 1
Re: Support for R language
« Reply #3 on: January 26, 2011, 04:57:18 PM »
1.) It would be great to have an option to display the file date as an extra column in the open file tab of the file toolbar (normally on the left).  Being able to sort asc/desc by clicking on name and path and date column headers would be ideal.

2.) Support for running R (CRAN R) code.

3.) SQL beautifier

Great product. Have been using it since the earliest days of Slickedit..  Thank you.