Using Renjin packages inside a R file run by @ScriptManager

I am trying to use csvread and ggplot inside a R script but am getting the following error:

org.renjin.eval.EvalException: Could not load package org.renjin.cran:csvread; tried org.renjin.cran:csvread, org.renjin.bioconductor:org.renjin.cran:csvread, org.renjin.cran:org.renjin.cran:csvread

I am loading the appropriate dependencies inside the pom.xml:

<dependencies>
		<dependency>
			<groupId>net.imagej</groupId>
			<artifactId>imagej</artifactId>
		</dependency>
		<dependency>
    		<groupId>org.renjin.cran</groupId>
    		<artifactId>ggplot2</artifactId>
    		<version>3.2.0-b8</version>
  		</dependency>
		<dependency>
    		<groupId>org.renjin.cran</groupId>
    		<artifactId>csvread</artifactId>
    		<version>1.2.1-b1</version>
  		</dependency>
	</dependencies>

@k3no, maybe I can help. I’ve been working through Renjin for a project of mine for the past month or so. At first, I was able to get Renjin and ggplot2 to work within ImageJ as a process generated by an IDE but not from vanilla ImageJ/FIJI. I believe this is because 1) maven in the IDE solves all the dependencies (ggplot has a handful) and 2) from the IDE it was easy to switch to Renjin v3.5b76.

To get my plugin to run in vanilla FIJI, I had to 1) replace the Renjin that shipped with FIJI (v3.5b76, listed below) and 2) provide the Renjin package jars(wrapped R libraries) with their dependencies that I wanted to use-by providing an uber jar. I’m not crazy about uber jars-in this case shaded-but it is working.

For reference, the Renjin files that come with FIJI I replaced/added:

methods
datasets
stats
grid
utils
gnur-compiler
gnur-runtime
gcc-bridge-compiler
graphics
grDevices

I’ve asked on the forum about getting the version updated in SciJava, so eventually this shouldnt be necessary!

Cheers. Seth

Could you send me your working version of FIJI?
That would be super helpful.

Yes, let me package it up. Going to put a pull request in for upgrading Renjin too-just haven’t gotten to it. I’ll email you momentarily.

Seth

1 Like