Interfaces/R/Jserver4R/Overview

From J Wiki
< Interfaces‎ | R
Jump to navigation Jump to search
Overview | Methods | Examples | Quirks

This is an interface to J64 for R on Windows/Mac/Linux. It requires J901 or later.

R loads a shared library to call J installed on the same machine.

For now, the interface supports arbitrary logical, integer and floating point arrays, as well as character strings and J boxed lists. The interface can be extended to support additional datatypes.

Basic Usage

Install the addon stats/jserver4r in the usual way.

The distributed script jserver.R has typical cover functions. You should copy and update this script for your own use.

The addon is initialized by calling the shared library, e.g. jserver4r.dll in Windows. The shared libraries are distributed in ~addons/stats/jserver4r/lib with source in the Public repository at stats/r/jserver4r/lib/. Copy the appropriate shared library to your working folder.

The distributed shared libraries should work on most platforms. If necessary, see libs.txt for information on rebuilding the libraries.

The interface must be able to load the J engine and require libraries in the path defined in jserver.R. Ensure that the J engine loaded is the right version, and not an earlier version that had been previously installed. If necessary, set an environment variable so that it is available.

OS dependent set up

macOS

Either set:

export DYLD_LIBRARY_PATH=/Users/chris/j9.5/bin:$DYLD_LIBRARY_PATH

or copy in libj.dylib and libgmp.dylib from your J bin folder to your working folder.

Also ensure that your files are not quarantined. In your working older run xattr -rc *.

Windows

The pthreadVC3.dll needs to be available to the interface. Either copy it from your J bin folder to your working folder or to c:\windows\system32.