Skip to content

scicloj/clojisr

Repository files navigation

clojuress

Clojure speaks statistics - a library for connecting Clojure to R

Clojars Project

Status

Not tested in production, still evolving.

Scope of the project

There are already stable libraries for Clojure-R interop - 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.

Video presentations

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

Note however that:

  • The API has changed since then (mainly data visualization support, clear code generation rules, different printing - see the Intro below).
  • On the meeting, there is some careless use of the term 'zero copy'. Actually, what is usually meant by this term is not supported at the moment.

Why this name?

Clojure Speaks Statistics is a homage to Emacs Speaks Statistics.

Meta Goals

  • Realize what is essential for Clojure to become a beginner-friendly solution for data science.

  • Expose the Clojure ecosystem to a different culture and to more diverse groups of users/programmers.

Technical Goals

  • A Function-centric API, where the default mode of usage is calling R functions on R objects, from Clojure (Status: supported)

  • "R code as Clojure data", inspired by but extending the EDN-based syntax inroducted in gg4clj and used in huri (Status: supported)

  • Interop with minimal copying of data (Status: supported)

  • Compatibility with common data abstractions such as tech.ml.dataset datasets (Status: partial support)

  • Convenient wrappers for common use cases, such as visualization (Status: wrote a basic wrapper to Rmarkdown)

  • Abstraction over different runtimes (GNUR R, Renjin, FastR) (Status: only GNU R is supported at the moment)

  • Convenient multi-session support (Status: a draft exists, needs some polish)

Usage requirements

  • Linux or MacOS

  • R

  • The Rserve R package (install.packages("Rserve")) Tested with Rserve version 1.8.6. Earlier versions are known to have a bug. Rserve 1.8.6 is currently not on CRAN, but can be installed with install.packages("Rserve","http://rforge.net")

  • This project

Clojars Project

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.

Tools used

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

  • In early versions, hara.test was used for automated docstrings by tests. We may come back to using it.

  • clj-kondo for code quality control

  • notespace for documentation and tests

License

Copyright © 2019 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.

About

Clojure speaks statistics - a bridge between Clojure to R

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages