rgo

package module
Version: v0.0.0-...-d0d85c2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2016 License: MIT Imports: 14 Imported by: 0

README

rgo

GoDoc Widget Travis Widget Coverage Status Widget

Documentation

Overview

Package rgo provides a mechanism to call into R. This package assumes that you have the R binary in your PATH and that you have the jsonlite and RCurl R packages installed.

Why make rgo?

R has many useful plotting and statistics libraries. rgo is a simple libary that gives you access to these from Go. This way, you can transform and process your data in Go, and use R's plotting/statistics libraries to generate your final figures. As a result, this package is not designed to be high-performance or have minimal memory consumption. Transferring data between Go and R requires making several copies of the data, and memory will not be freed in R. Nevertheless, this package should be sufficient for basic R usage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsError

func IsError(e error) bool

func IsWarning

func IsWarning(e error) bool

Types

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

Conn is used to start and communicate with an R process. Conn is NOT thread-safe. However, you may run multiple Conn's in the same process safely. It is safe to run successive operations on Conn successively and retrieve any errors using Error(). Do not that although R warnings will be returned in method calls, they will not be captured in Error().

Objects in R will not be freed until the Conn is closed.

func Connection

func Connection(opts ...ConnOption) (*Conn, error)

Connections creates a *Conn which can be used to run R commands.

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) Error

func (c *Conn) Error() error

Error returns the first error that occured in the sequence of operations. R warnings are ignored.

func (*Conn) Get

func (c *Conn) Get(data interface{}, name string) error

Get gets data from R. data will be deserialized from json.

func (*Conn) R

func (c *Conn) R(cmd string) error

R sends a command to R. An Error or Warning generated by the command will be returned as an RError or RWarning.

func (*Conn) Rf

func (c *Conn) Rf(format string, args ...interface{}) error

Rf is like R but takes a format string and arguments.

func (*Conn) Send

func (c *Conn) Send(data interface{}, name string) error

Send sends data into R. data must be json-serializable.

func (*Conn) SendDF

func (c *Conn) SendDF(df dataframe.DataFrame, name string) error

SendDF sends a DataFrame and properly unpacks it as an R data frame.

func (*Conn) Strict

func (c *Conn) Strict() error

Strict sets all warnings to become errors. Setting this is recommended as R is generous as to what constitutes an error.

type ConnOption

type ConnOption func(*connConfig)

func WithDebug

func WithDebug() ConnOption

type DependencyError

type DependencyError interface {
	error
	MissingDependencies() []string
}

type RError

type RError interface {
	error
	IsError()
}

type RWarning

type RWarning interface {
	error
	IsWarning()
}

Directories

Path Synopsis
Package dataframe provides a R-like data frame type that can be easily transferred into R using the rgo package.
Package dataframe provides a R-like data frame type that can be easily transferred into R using the rgo package.
This package provides utility functions for interacting with R. This package is highly experimental and the functionality will eventually be split into more appropriate packages (e.g.
This package provides utility functions for interacting with R. This package is highly experimental and the functionality will eventually be split into more appropriate packages (e.g.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL