Home

Awesome

Clojars Project cljdoc badge example workflow

ClojisR

Clojure speaks statistics - a jisr between Clojure and R

Documentation

How to pronounce it?

The beginning of the pronunciation is the same as Clojure, but then it rhymes with 'kisser'. Actually, the last vowel is nonexistent, so you may try to pronounce it with less movement between s and r, like 'yesssr!'.

Status

Clojurists Together

Hurray!

We are happy to announce that ClojisR is selected by Clojurists Together in Q4 2020! Expect more information soon.

Scope of the project

Libraries for Clojure-R interop are not new - see this list.

This project suggests yet another way to use R from Clojure.

Currently we target only JVM Clojure, but we are interested in generalizing the work to Clojurescript.

The related problem, of calling Clojure from R, may be addressed too in the future. We are experimenting with that.

Meta Goals

Technical Goals

Usage requirements

MacOS installation

Installing R with Rserve on MacOS can be problematic due to issues related to openssl installation. Please apply following steps (thanks to @ezmiller):

  1. Download the lastest R for mac from here: https://cloud.r-project.org/
  2. Install openssl: brew install openssl.
  3. Make sure that the openssl library is linked. Try in order:
    • brew link --force openssl
    • If that doesn't work, follow directions in brew info openssl for setting environment variables. Set the LIBRARY_PATH environment variable to the location of the library, e.g. export LIBRARY_PATH=/usr/local/opt/openssl@1.1/lib.

Setting up the logging

:jvm-opts ["-Dclojure.tools.logging.factory=clojure.tools.logging.impl/jul-factory"]

Docker image

Thanks to Carsten Behring we have a Docker template prepared

https://github.com/behrica/clj-py-r-template

The Dockerfile of the template adds as well python + libpython-clj for completeness.

So it has in a single place all dependencies and they do work together and no further setup is required.

There is as well a devcontainer setup in this GitHub template. It provides as well an out-of-the box working environment and template for projects using ClojisR (and libpythion-clj

Checking if it works

This should work for you (assuming you have the clj tool):

$ clj -Sdeps '{:deps {scicloj/clojisr {:mvn/version "1.0.0-BETA20"}}}'
Clojure 1.10.1
user=> (require '[clojisr.v1.r :refer [r]])

user=> (r '(+ 1 2))
[1] 3

Known issues

Video presentations

The main ideas were discussed at Scicloj Web meeting #7 and ClojuTRE 2019.

Note however that:

Tutorials

Background

  1. Lisp for statistical computing

  2. Calling R from Clojure: existing libraries

  3. R backends

  4. Some of R's data abstractions

  5. Clojure's counterparts of R's data abstractions

Choices of the current project

Here are the current priorities of the project in some central design and implementation questions.

Future opportunities

Here are some possible future developments we are considering.

Discussion

Please share your comments, thoughts, ideas and questions at the Issues Page of this project and at the r-interop stream of the Clojurians Zulip.

Also we run a stream for developers or people interested in contributing.

Testing

The tests are regular clojure.test tests, but are auto-genedated from the tutorials.

Tools used

Working on this project, we enjoyed the following tools (partial list):

License

Copyright © 2019-2020 Scicloj

This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.

This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version, with the GNU Classpath Exception which is available at https://www.gnu.org/software/classpath/license.html.