/Rservex

Rservex communicates R with Elixir

Primary LanguageElixirApache License 2.0Apache-2.0

Rservex

Rservex is an under-development client for Rserve. Aiming to enable the R <--> Elixir interoperation.

Rservex is Heavily inspired in Erserve

Current State

Currentle Rservex can:

  • Create a connection
  • Close a connection
  • Send a command and receives str responses

Example

In R:

library(Rserve)
Rserve()

In Elixir:

iex(1)> conn = Rservex.open()                  

iex(2)> Rservex.eval(conn, "'Hello World'")                  
{:xt_arr_str, ["Hello World"]}

iex(3)> Rservex.eval(conn, "c('Hello', 'World')")
{:xt_arr_str, ["Hello", "World"]}

iex(4)> Rservex.eval(conn, "library(Pmetrics)") 
{:xt_arr_str,
 ["rjson", "Pmetrics", "stats", "graphics", "grDevices", "utils", "datasets",
  "methods", "base", ""]} 

Installation

rservex is available in Hex, the package can be installed by adding rservex to your list of dependencies in mix.exs:

def deps do
  [
    {:rservex, "~> 0.1.2"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. The docs can be found at https://hexdocs.pm/rservex.