[R-gui] Interfaces between GUIs and R

Byron Ellis bellis at hsph.harvard.edu
Sat Apr 5 02:22:38 MEST 2003


On Friday, April 4, 2003, at 04:31  AM, Philippe Grosjean wrote:

> I capture the graph device window, i.e., I display it in my own 
> application
> instead of in its original place but R is still responsible directly of
> (re)drawing its content. This way, I do not need to exchange large 
> amounts
> of data between the backend and the frontend (indeed, there are no 
> exchanges
> at all!) and all functionalities provided by the original R graph 
> device are
> still available in SciViews, like copy metafile/bitmap to the 
> clipboard,
> save the graphs directly in different formats, save and restore to and 
> from
> a variable in the R user workspace and management of a graph history 
> that is
> specific to the Windows version of R.
>
Ah, slick :-)

>
> Then, as you suggest, OpenMath could be an excellent solution to 
> interface
> R. However, R  being a statistical package there are few needs in
> representing complex mathematical notation. Even, R uses its own 
> notation
> for statistical models (formulas). I wonder if and how this could be 
> easily
> and automatically translated in a more traditional mathematical 
> notation,...
> and even if this would be desirable?!
>

Well, the nice thing about OpenMath is the namespacing (Content 
Dictionaries) let you specify pretty much any structure you like so it 
would be possible to completely serialize any R type using OpenMath in 
a straightforward manner. So (to steal of pseudo-Mathematica for a 
moment)
x <- function(a,b) { a + b }

R:Assign[Var(x),R:Function[{Var(a),Var(b)},{R:Sum[Var(a),Var(b)]}]]

Whether or not we'd WANT to do this is up for grabs :-) My intent is 
to, essentially, implement the equivalent of "Enter" from Mathematica 
(for entering lines of code) initially as well as the code necessary to 
transport graphics data across the link in a "display list" of some 
sort (or at the very least as a set of OpenMath functions). I'd rather 
have something simple that works at first rather than something complex 
that never gets finished ;-)

>
> Do you intend to initiate a project for making an OpenMath interface 
> for R?
> If yes, I would like to take part of it, and ultimately include these
> features to the SciViews R plug.
>

I have a *very* primitive OpenMath package for R that allows two R 
instances to talk to each other at the moment (via UNIX and TCP 
sockets). It can pass the primitives as well as Objects (lists with a 
class attribute basically) and Applications (also a list, different 
class attribute). It seems like this might eventually be a job for 
REventLoop, but I haven't yet fathomed how to do away with stdin/stdout 
entirely (since this I/O mechanism is message based, not data stream 
based stdin/stdout type interfaces don't have much meaning... though I 
would *like* Enter[Some Text] to simulate entering a line for managing 
block generation (each output generating statement generates a new 
block of text) and error reporting as its oh-so-much-more-useful to 
have a "syntax error" attached to a particular line rather than an 
arbitrarily large hunk of code).

There isn't any documentation at all and little error handling, but 
since you're interested I can start making that package available 
through some mechanism relatively soon (I should really get this stuff 
into a SourceForge project or something similar). The "StatPaper" side 
of things is all ObjectiveC based and actually already supports the 
notion of an "evaluator" where objects are set to handle a particular 
namespace (for instance, there is a class that handles the "Plot" 
namespace for mapping a prospective stream of ObjectMath data back into 
an image representation, a PDF in this case, which is based on 
devQuartz... though with different handling for font metrics and such)

>
> Best Regards,
>
> Philippe Grosjean
>
> ...........]<(({?<...............<?}))><...............................
>  ) ) ) ) )
> ( ( ( ( (       Dr. Philippe Grosjean
>  ) ) ) ) )
> ( ( ( ( (       LOV, UMR 7093
>  ) ) ) ) )      Station Zoologique
> ( ( ( ( (       Observatoire Oceanologique
>  ) ) ) ) )      BP 28
> ( ( ( ( (       06234 Villefranche sur mer cedex
>  ) ) ) ) )      France
> ( ( ( ( (
>  ) ) ) ) )      tel: +33.4.93.76.38.18, fax: +33.4.93.76.38.34
> ( ( ( ( (
>  ) ) ) ) )      e-mail: phgrosjean at sciviews.org
> ( ( ( ( (       SciViews project coordinator (http://www.sciviews.org)
>  ) ) ) ) )
> .......................................................................
>
>
>
>
>
Byron Ellis (bellis at hsph.harvard.edu)
"Oook" - The Librarian



More information about the R-SIG-GUI mailing list