All Projects → senseyeio → Roger

senseyeio / Roger

Licence: mit
Golang RServe client. Use R from Go

Programming Languages

go
31211 projects - #10 most used programming language
r
7636 projects

Projects that are alternatives of or similar to Roger

Learn Julia The Hard Way
Learn Julia the hard way!
Stars: ✭ 679 (+173.79%)
Mutual labels:  data-science, scientific-computing
Pygam
[HELP REQUESTED] Generalized Additive Models in Python
Stars: ✭ 569 (+129.44%)
Mutual labels:  data-science, scientific-computing
Kneed
Knee point detection in Python 📈
Stars: ✭ 328 (+32.26%)
Mutual labels:  data-science, scientific-computing
Matplotplusplus
Matplot++: A C++ Graphics Library for Data Visualization 📊🗾
Stars: ✭ 2,433 (+881.05%)
Mutual labels:  data-science, scientific-computing
Awesome Scientific Python
A curated list of awesome scientific Python resources
Stars: ✭ 127 (-48.79%)
Mutual labels:  data-science, scientific-computing
Reflow
A language and runtime for distributed, incremental data processing in the cloud
Stars: ✭ 706 (+184.68%)
Mutual labels:  data-science, scientific-computing
Gop
GoPlus - The Go+ language for engineering, STEM education, and data science
Stars: ✭ 7,829 (+3056.85%)
Mutual labels:  data-science, scientific-computing
Tiledb
The Universal Storage Engine
Stars: ✭ 1,072 (+332.26%)
Mutual labels:  data-science, scientific-computing
Scilab
Free and Open Source software for numerical computation providing a powerful computing environment for engineering and scientific applications.
Stars: ✭ 138 (-44.35%)
Mutual labels:  data-science, scientific-computing
Collapse
Advanced and Fast Data Transformation in R
Stars: ✭ 184 (-25.81%)
Mutual labels:  data-science, scientific-computing
Reprozip
ReproZip is a tool that simplifies the process of creating reproducible experiments from command-line executions, a frequently-used common denominator in computational science.
Stars: ✭ 231 (-6.85%)
Mutual labels:  scientific-computing
Data Science Free
Free Resources For Data Science created by Shubham Kumar
Stars: ✭ 232 (-6.45%)
Mutual labels:  data-science
Opends4all
OpenDS4All project, hosted by LF AI & Data
Stars: ✭ 240 (-3.23%)
Mutual labels:  data-science
Cjworkbench
The data journalism platform with built in training
Stars: ✭ 244 (-1.61%)
Mutual labels:  data-science
Pysparkling
A pure Python implementation of Apache Spark's RDD and DStream interfaces.
Stars: ✭ 231 (-6.85%)
Mutual labels:  data-science
Pyglmnet
Python implementation of elastic-net regularized generalized linear models
Stars: ✭ 235 (-5.24%)
Mutual labels:  data-science
Prodigy Recipes
🍳 Recipes for the Prodigy, our fully scriptable annotation tool
Stars: ✭ 229 (-7.66%)
Mutual labels:  data-science
Webstruct
NER toolkit for HTML data
Stars: ✭ 230 (-7.26%)
Mutual labels:  data-science
Tablesaw
Java dataframe and visualization library
Stars: ✭ 2,785 (+1022.98%)
Mutual labels:  data-science
Rulinalg
A linear algebra library written in Rust
Stars: ✭ 247 (-0.4%)
Mutual labels:  scientific-computing

Roger

GoDoc Build Status Join the chat at https://gitter.im/senseyeio/roger

Roger is a Go RServe client, allowing the capabilities of R to be used from Go applications.

The communication between Go and R is via TCP. It is thread safe and supports long running R operations synchronously or asynchronously (using channels).

package main

import (
	"fmt"

	"github.com/senseyeio/roger"
)

func main() {
	rClient, err := roger.NewRClient("127.0.0.1", 6311)
	if err != nil {
		fmt.Println("Failed to connect")
		return
	}

	value, err := rClient.Eval("pi")
	if err != nil {
		fmt.Println("Command failed: " + err.Error())
	} else {
		fmt.Println(value) // 3.141592653589793
	}

	helloWorld, _ := rClient.Eval("as.character('Hello World')")
	fmt.Println(helloWorld) // Hello World

	arrChan := rClient.Evaluate("Sys.sleep(5); c(1,1)")
	arrResponse := <-arrChan
	arr, _ := arrResponse.GetResultObject()
	fmt.Println(arr) // [1, 1]
}

Response Type Support

Roger currently supports the following response types from R:

  • string and string arrays
  • booleans and boolean arrays
  • doubles and double arrays
  • ints and int arrays
  • complex and complex arrays
  • lists
  • raw byte arrays

With the use of JSON, this capability can be used to transfer any serializable object. For examples see sexp_parsing_test.go.

Assignment Support

Roger allows variables to be defined within an R session from Go. Currently the following types are supported for variable assignment:

  • string and string arrays
  • byte arrays
  • doubles and double arrays
  • ints and int arrays

For examples see assignment_test.go.

Setup

Rserve should be installed and started from R:

install.packages("Rserve")
require('Rserve')
Rserve()

More information is available on RServe's website.

If you would like to exploit the current R environment from go, start RServe using the following command:

install.packages("Rserve")
require('Rserve')
run.Rserve()

Install Roger using:

go get github.com/senseyeio/roger

Testing

To ensure the library functions correctly, the end to end functionality must be tested. This is achieved using Docker and Docker Compose. To run tests, ensure you have both Docker and Docker Compose installed, then run docker-compose build && docker-compose up -d from within the test directory. This command will build and start a docker container containing multiple RServe servers. These servers will be utilized when running go test from the project's base directory. To stop the docker container call docker-compose stop from the test directory.

Contributing

Issues, pull requests and questions are welcomed. If required, assistance can be found in the project's gitter chat room.

Pull Requests

  • Fork the repository
  • Make changes
  • Ensure tests pass
  • Raise pull request
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].