[Rd] RJava and Orca...

A.J. Rossini rossini@blindglobe.net
27 Jul 2000 17:11:14 -0700


It's cool, it's exciting, and much thanks to Duncan.  He announced
RJava yesterday (or this morning?) on the R-devel list, and it's
really worth it.

        http://www.omegahat.org/RSJava

for more details.

But it does mean that we can run Orca code directly within R, (without
Thomas' socket connections) (and also means that we really need a
"stop" button, since killing the visualizations kills the R process in
an ugly fashion).

To do:
1. write up a converter for feeding R DataFrames right into Orca
2. add the "stop" or "destroy" button described above.
3. do the "right thing" for brushing.

All you need to do from the following scripts is to install Java for
R, redefine where "orcaHomeDir" is, and run it...

I'll be checking these into the Orca directory structure soon!

Since I'm cc'ing r-devel, I might as well point to Orca:

        http://pyrite.cfas.washington.edu/orca

best,
-tony


Examples:
-------------- Initialization.R --------------
library(Java)

## Initialize Environment
orcaHomeDir <- "/biostat/faculty0/rossini/sandbox/Src/Java/Orca/orca/"
orcaHomeOrcaJar <- paste(orcaHomeDir,"classes/orca.jar",sep="")
orcaHomeVisADJar <- paste(orcaHomeDir,"jars/visad.jar",sep="")
orcaClasses <- c(orcaHomeOrcaJar,orcaHomeVisADJar)

## Initialize JVM
.JavaInit(list(classPath=orcaClasses))

## Verify JVM has Orca in its path
.Java("System", "getProperty", "java.class.path")

-------------- VarSelExample.R ---------------

## The .name="blah" part turns out to be essential...
od.1  <- .Java("org.orca.data.parsers.OrcaDataSource",
               "openFileData","data/normclust.dat",.name="od")
dsp.1 <- .JavaConstructor("DataSourcePipe",od.1,.name="dsp")
sdp.1 <- .JavaConstructor("StdDataPipe",dsp.1,.name="sdp")
vsp.1 <- .JavaConstructor("VarSelPipe",sdp.1,.name="vsp")
rp.1 <- .JavaConstructor("Render2DPipe",vsp.1,.name="rp")
wp.1 <- .JavaConstructor("WindowPipe",rp.1,.name="wp")
.Java(wp.1,"reloadView")

-------------- TaoExample.R ------------------

## You need to be "initialized" for this... (see Initialize.R above) 

OrcaDataFile     <- "data/orca.tao.time"
OrcaDataTimeVar  <- "Group"
OrcaDataGroupVar <- "Time"

## Get the data
od.1 <- .Java("org.orca.data.parsers.OrcaDataSource",
              "openFileData",
              OrcaDataFile,
              .name="od");

## Acknowledge special covariates
od.1 <- .JavaConstructor("MarkTimeSeriesData",
                         od.1,
                         OrcaDataTimeVar,
                         .name="od2");
od.1 <- .JavaConstructor("MarkGroupData",
                         od.1,
                         OrcaDataGroupVar,
                         .name="od3");

## Run it through the standardization and brushing stuff.
dsp.1 <- .JavaConstructor("DataSourcePipe",
                          od.1,
                          .name="dsp")
stdd1.1 <- .JavaConstructor("StdDataPipe",
                            dsp.1,
                            .name="stdd1")

stdd.1 <- .JavaConstructor("ReorderPipe",
                           stdd1.1,
                           .name="stdd")

## Set up the pairs plot
mlp.1 <- .JavaConstructor("MultiLayoutPipe",
                          stdd.1,
                          .name="mlp")
obw.1 <- .JavaConstructor("WindowPipe",
                          mlp.1,
                          .name="obw")

## Set up the grand tour
ortp1.1 <- .JavaConstructor("TourPipe",
                            stdd.1,
                            .name="ortp1")
t2p2.1 <- .JavaConstructor("Render2DPipe",ortp1.1,
                           .name="t2p2")
obw4.1 <- .JavaConstructor("WindowPipe",t2p2.1,.name="obw4")

## Set up the TimeSeries 
ortp2.1 <- .JavaConstructor("TourPipe",stdd.1,.name="ortp2")
t2p.1 <- .JavaConstructor("TimeSeriesPipe",ortp2.1,.name="t2p")
obw3.1 <- .JavaConstructor("WindowPipe",t2p.1,.name="obw3")

## It can be better to pause these -- don't start them immediately
## after each other!
.Java(obw.1 , "reloadView")
.Java(obw4.1, "reloadView")
## The following doesn't work yet (array out of bounds bug)
.Java(obw3.1, "reloadView")

----------------------------------------------------------

best,
-tony


-- 
A.J. Rossini
rossini@blindglobe.net				BlindGlobe Networks
rossini@biostat.washington.edu			U Washington (from home)
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._