Does Renjin 3.5 support ggplot2?

244 views Asked by At

I am getting an error when executing a simple ggplot2 script. I thought ggplot2 was supported since Renjin 3.5 Beta or maybe I am doing something wrong. I am using the ClasspathPackageLoader and add ggplot2 as a Gradle dependency.

repositories {
    mavenCentral()
    maven { url "https://nexus.bedatadriven.com/content/groups/public" }
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.12'
    compile 'org.renjin:renjin-script-engine:3.5-beta43'
    compile 'org.renjin.cran:ggplot2:3.2.0-b8'
}

The Java code is fairly simple:

RenjinScriptEngineFactory factory = new RenjinScriptEngineFactory();
ScriptEngine engine = factory.getScriptEngine();

engine.eval("library(ggplot2)");
engine.eval("ggplot(mtcars, aes(mpg, wt)) + geom_point()");
engine.eval("ggsave('mtcars.png')");

The full error trace is:

> Task :Test.main() FAILED
Exception in thread "main" org.renjin.eval.EvalException: IOException while loading package org.renjin.cran:ggplot2: IOException while loading package org.renjin.cran:tibble: IOException while loading package org.renjin.cran:pillar: IOException while loading package org.renjin.cran:crayon: Cannot run program "tput" (in directory "D:\git\renjin-ggplot2"): CreateProcess error=2, Das System kann die angegebene Datei nicht finden
    at org.renjin.primitives.packaging.NamespaceRegistry.load(NamespaceRegistry.java:191)
    at org.renjin.primitives.packaging.NamespaceRegistry.getNamespace(NamespaceRegistry.java:143)
    at org.renjin.primitives.packaging.NamespaceRegistry.getNamespace(NamespaceRegistry.java:114)
    at org.renjin.primitives.packaging.Packages.library(Packages.java:39)
    at org.renjin.primitives.R$primitive$library.doApply(R$primitive$library.java:68)
    at org.renjin.primitives.R$primitive$library.applyPromised(R$primitive$library.java:33)
    at org.renjin.sexp.BuiltinFunction.apply(BuiltinFunction.java:100)
    at org.renjin.primitives.special.InternalFunction.apply(InternalFunction.java:46)
    at org.renjin.sexp.FunctionCall.eval(FunctionCall.java:80)
    at org.renjin.eval.Context.evaluate(Context.java:282)
    at org.renjin.primitives.special.BeginFunction.apply(BeginFunction.java:39)
    at org.renjin.sexp.FunctionCall.eval(FunctionCall.java:80)
    at org.renjin.sexp.Closure.applyPromised(Closure.java:200)
    at org.renjin.sexp.Closure.apply(Closure.java:133)
    at org.renjin.sexp.FunctionCall.eval(FunctionCall.java:80)
    at org.renjin.sexp.ExpressionVector.eval(ExpressionVector.java:85)
    at org.renjin.eval.Context.evaluate(Context.java:282)
    at org.renjin.script.RenjinScriptEngine.eval(RenjinScriptEngine.java:168)
    at org.renjin.script.RenjinScriptEngine.eval(RenjinScriptEngine.java:127)
    at Test.main(Test.java:13)

This is produced with the statement evaluating the library call. Thanks a lot.

1

There are 1 answers

0
Denis A On

if you use the last beta - all ok

    <version>3.5-beta76</version>