Recent Changes - Search:

edit SideBar

RLanguageActors

Running an R Kepler Demo

In February, 2017, running R 3.3.2 under Red Hat Linux 6.5 from the Kepler devel sources.

  [cxh@terra build-area]$ R

  R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"

When I start up Kepler (cd build_area; ant run) and open up R -> R -> R_3D_plot.xml, I get a 3D-plot, indicating that Kepler and R work for me.

However, the JRI (Java R Interface) demos don't work for me. When I run a demo in R-> JRI, I get:


       [run] # Manager._registerShutdownHook(): State is The model is executing, which is not IDLE.  Waiting for model to stop.
       [run] Cannot find JRI native library!
       [run] Please make sure that the JRI native library is in a directory listed in java.library.path.
       [run]
       [run] java.lang.UnsatisfiedLinkError: no jri in java.library.path
       [run]     at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
       [run]     at java.lang.Runtime.loadLibrary0(Runtime.java:870)
       [run]     at java.lang.System.loadLibrary(System.java:1122)
       [run]     at org.rosuda.JRI.Rengine.<clinit>(Rengine.java:19)
       [run]     at org.ecoinformatics.seek.R.RExpression2._initializeRengine(RExpression2.java:569)
       [run]     at org.ecoinformatics.seek.R.RExpression2._fireUsingJRI(RExpression2.java:547)
       [run]     at org.ecoinformatics.seek.R.RExpression2.fire(RExpression2.java:289)
       [run]     at ptolemy.actor.AtomicActor.iterate(AtomicActor.java:512)
       [run]     at ptolemy.actor.sched.StaticSchedulingDirector.fire(StaticSchedulingDirector.java:216)
       [run]     at ptolemy.domains.sdf.kernel.SDFDirector.fire(SDFDirector.java:500)
       [run]     at ptolemy.actor.CompositeActor.fire(CompositeActor.java:454)
       [run]     at ptolemy.actor.Manager.iterate(Manager.java:841)
       [run]     at ptolemy.actor.Manager.execute(Manager.java:367)
       [run]     at ptolemy.actor.Manager.run(Manager.java:1252)
       [run]     at ptolemy.actor.Manager$PtolemyRunThread.run(Manager.java:1909)

I'll look into this eventually, but I believe that JRI needs to be installed and compiled for each platform.

Kepler-2.5 macOS Sierra Problem

I get the failure below under macOS Sierra and Kepler-2.5 downloaded from https://kepler-project.org/users/downloads when I try to open R->R->R_3D_Plot.xml

 ptolemy.kernel.util.IllegalActionException: There has been a problem running the R script!
 It may be due to an error in your script, it may be that R is not
 installed on your system, or it may not be on your path and cannot
 be located by Kepler.  Please make sure R is installed and the
 R command line executable is in the path.For more information, see
  section 8.2.2 of the Kepler User Manual.
   in .R_3D_Plot.RExpression
 Because:
 java.lang.NullPointerException
     at org.ecoinformatics.seek.R.RExpression.fire(RExpression.java:922)
     at ptolemy.actor.AtomicActor.iterate(AtomicActor.java:496)
     at ptolemy.actor.sched.StaticSchedulingDirector.fire(StaticSchedulingDirector.java:216)
     at ptolemy.domains.sdf.kernel.SDFDirector.fire(SDFDirector.java:496)
     at ptolemy.actor.CompositeActor.fire(CompositeActor.java:454)
     at ptolemy.actor.Manager.iterate(Manager.java:830)
     at ptolemy.actor.Manager.execute(Manager.java:367)
     at ptolemy.actor.Manager.run(Manager.java:1241)
     at ptolemy.actor.Manager$PtolemyRunThread.run(Manager.java:1879)
 Caused by: java.lang.NullPointerException
     at org.ecoinformatics.seek.R.RExpression.fire(RExpression.java:905)
     ... 8 more
 Caused by: java.lang.NullPointerException
     at org.ecoinformatics.seek.R.RExpression.fire(RExpression.java:905)
     at ptolemy.actor.AtomicActor.iterate(AtomicActor.java:496)
     at ptolemy.actor.sched.StaticSchedulingDirector.fire(StaticSchedulingDirector.java:216)
     at ptolemy.domains.sdf.kernel.SDFDirector.fire(SDFDirector.java:496)
     at ptolemy.actor.CompositeActor.fire(CompositeActor.java:454)
     at ptolemy.actor.Manager.iterate(Manager.java:830)
     at ptolemy.actor.Manager.execute(Manager.java:367)
     at ptolemy.actor.Manager.run(Manager.java:1241)
     at ptolemy.actor.Manager$PtolemyRunThread.run(Manager.java:1879)

However, if I build from sources via https://kepler-project.org/developers/teams/build/systems/build-system/extension-build-system, then it works.

So, I suggest building from sources to use R under Kepler.

Dan Crawl suggested:

If you right-click on the R actor in the workflow, and select 'Listen to Actor', you can see any error messages from R. This will let you know if there is an error in your R code or a missing package.

R Language Actors

In Kepler, there are two versions of the RExpression actor.

  bash-3.2$ cd ~/src/kepler
  bash-3.2$ find . -name "RExpression*"
  ./ptolemy/src/ptolemy/actor/lib/r/RExpression.java
  ./ptolemy/src/ptolemy/actor/lib/r/RExpression2.java

The above are the copies I made of the RExpression actor from Kepler and put them into the ptII tree. Note that Kepler includes a copy of the Ptolemy II tree. If you are building Kepler using ant, then a copy of the ptII tree is checked out for you

RExpression executes a separate R process.

RExpression2 interfaces to R using a shared library. Christopher has not used RExpression2 much.

  ./ptolemy/src/ptolemy/actor/lib/r/test/auto/RExpression_Dataframe_Test.xml
  ./ptolemy/src/ptolemy/actor/lib/r/test/auto/RExpression_Matrix_IO_Test.xml

The above are two tests for the RExpression actor that executes a separate R process. Christopher has not yet created any tests for the RExpression2 actor because the RExpression2 actor requires installation of a shared library.

  ./ptolemy/target/classes/ptolemy/actor/lib/r/RExpression$_StreamReaderThread.class
  ./ptolemy/target/classes/ptolemy/actor/lib/r/RExpression.class
  ./ptolemy/target/classes/ptolemy/actor/lib/r/RExpression2.class

The above are just the .class files for the Ptolemy II versions of the RExpression actors.

  ./r/resources/kar/RExpression
  ./r/resources/kar/RExpression/RExpression.xml

The above is the kar files for RExpression.

  ./r/src/org/ecoinformatics/seek/R/RExpression.java
  ./r/src/org/ecoinformatics/seek/R/RExpression2.java

Above are the two Kepler actors that were the sources of the ptII versions:

  ./r/target/classes/org/ecoinformatics/seek/R/RExpression$_StreamReaderThread.class
  ./r/target/classes/org/ecoinformatics/seek/R/RExpression.class
  ./r/target/classes/org/ecoinformatics/seek/R/RExpression2.class

Above are the Kepler .class files for the actors.

  ./r/workflows/demos/JRI/problems/RExpression_Dataframe_Test.xml
  ./r/workflows/demos/JRI/RExpression_Matrix_IO_Test.xml
  ./r/workflows/demos/R/RExpression_Dataframe_Test.xml
  ./r/workflows/demos/R/RExpression_Matrix_IO_Test.xml

Above are some Kepler demos for these actors. JRI is the Java R Interface and would work with RExpression2.

See Also

Edit - History - Print - Recent Changes - Search
Page last modified on February 08, 2017, at 12:18 AM