From: "M. Edward (Ed) Borasky" Date: 2007-12-24T05:07:24+09:00 Subject: Re: Fairly elementary UNIX question Steckly, Ron wrote: > Hi, > > > > I've been learning a lot about the .NET architecture and scripting to it > using Visual Basic and C#. I'm trying to write a program right now in > UNIX and I'm a little perplexed. How do I tap into events in UNIX? For > example, if I were to write a script to enter a command into the R > Statistics Program running in Linux, how would I do that? > > Normally, in bash I would type R > > And a new prompt comes up and you can type whatever command you want. > > I'd like to be able to make a simple GUi for it so that its easier for > people to enter commands who are still learning R. But I'm not sure how > to script to a terminal.... > > > > Am I completely on the wrong track? Well ... not so much on the wrong track as on the wrong mailing list. :) But since I'm an R programmer, I'll give you the R answer. :) 1. On *Windows*, there is an excellent GUI/IDE available for the language -- the base Windows R installation. 2. There is a mailing list devoted to R GUI packages, which is at https://stat.ethz.ch/mailman/listinfo/r-sig-gui 3. In terms of learning R from a GUI, I highly recommend the R Commander library. Assuming you want to make this available to other users or you have R installed at the system level, become root, start up R and type > install.packages("Rcmdr", depend=c("Depends", "Suggests", "Imports")) You'll need the Tcl/Tk stuff in R for this to work, so if your R doesn't have that, you'll need to rebuild it. Note that the above will also work on the Windows R!! 4. Now you have R Commander installed. At the R prompt, type > library(Rcmdr) This brings up the GUI. What's nice about R Commander is that it allows you to capture the script and its output from everything you've done. In addition, if you drag in all the dependencies, you get some of the more convenient functionality like scatterplot matrices, etc., built in. I should note that the philosophy of R (and its ancestor S) it that it *is* a programming language, and even if you do have a "fancy GUI" like SPSS or Minitab, that's only a "crutch" until you learn to program in the language. Now, if you're an experienced Ruby GUI programmer and want to build your own, there's an R - Ruby bridge called "rsruby", which I think is in the RubyGems repository. It's a little tricky to install -- some Linux distros don't put things in exactly the right place. But once you get it installed, a Ruby program can interact with R without all the "shell and pipe nonsense". :)