R to Java Java to R

The R & S - Java Interface Examples

  • DynamicCompile.R
    This shows how one can dynamically compile a Java class that implements a Java interface by defining each of the methods in that interface to be calls to the corresponding R function and exported R object.
  • DynamicButtonCallback.R
    This example illustrates the use of the dynamic compilation mechanism in the canonical example of using an R function as an action listener for a Swing JButton.
  • StatData.R
    Uses the Omegahat class StatDataURL to read the contents of a URL line-by-line and return them as an R character vector.
  • button.R
    Uses an R closure to respond to the user clicking on a Java button, and illustrates the implicit conversion of an R object to a foreign reference and the use of the .sigs argument to convert an R reference to a particular Java class.
  • buttonCallback.R
    Another example of an R function used to respond to a user event from a button click.
  • converters.R
    Illustration of registering and removing a C routine to convert a Java object to an R object.
  • dataFrameView.R
    Illustration of how to use the Omegahat DataFrameViewer class to display (and edit) an R data frame.
  • dataFrameReferenceView
    This is similar to dataFrameView but rather than copying the contents of the R data frame to a corresponding Java class that is self-contained, we send a reference to the R data frame and arrange to have the Java viewer callback to R to get the information such as variable names, number of columns and rows and cell values.
  • file.choose.R
    A simple example of using the .Java and .JavaConstructor functions to allow the user navigate their directories and select a file using the Swing GUI classes.
  • functionConverters.R
    Provides an example of how to register R functions to convert Java objects to R objects when they are returned from .Java .JavaConstructor and .OmegahatExpression() calls.
  • getClass.R
    A very simple illustration of using several inlined .Java calls to compute the super class of an object.
  • mouseMotion.R
    An example of using an R function to respond to mouse movement events on a Swing component and dynamically displaying the X and Y position of the mouse in a Swing label.
  • calc.R
    A basic GUI calculator.
  • ttest.R
    A GUI mimicing the t-test example in the Tcl/Tk package for R illustrating the similarities and differences in programming in the two different packages.
  • tdist.R
    An example of connecting a slider with an R graphics device to compute the probabilities of a t distribution for a given value.
  • Calling R from Java

  • JavaRCall
    An example of calling R from Java, allowing one to create the R-Java interpreter as a background object or passing control to the R event loop.
  • JavaRCall
    An example of calling R from Java.
  • JavaRPlot
    An example of creating R graphics displays from Java.
  • JavaRPrompt
    A simple example of using Java to get user input and pass it to R to be evaluated. Basically, this provides an alternative event loop.

  • Duncan Temple Lang <duncan@research.bell-labs.com>
    Last modified: Wed Sep 19 07:07:44 CDT 2001