Skip to content

gitter-badger/roger

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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).

Roger is a work in progress, currently supporting string, string array, double and double array response types. With the use of JSON, this capability can be used to transfer any serializable object.

##Example

package main

import (
	"fmt"

	"github.com/dareid/gore"
)

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

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

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

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

##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

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
  • Raise pull request

About

Golang RServe client. Use R from Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%