Documentation ¶
Overview ¶
Package r provides an interface to the R statistical programming language. Users can interface with R through three methods: Call, Get or Rpc. Call executes a function call and returns a unique key that can be used in subseqent calls to Get to retrieve the results. Get can return results in json, csv, png or pdf. Rpc can be used to bundle Call and Get in a single function call.
As a single R session:
session, err := r.NewSession() ... key, err := session.Call("stats","rnorm","n=100") ... res, err := session.Get(key, "json") ... res, err = session.Rpc("stats", "rnorm", "n=100", "json") ...
standalone server that accepts HTTP requests (e.g. from the Client or curl)
s, err := r.Server(4, "/tmp/kvik") ... s.Start(":8181")
or a client if there is a server running somewhere:
client := r.Client{"http://localhost.com:8181", "username","password"} key, err := client.Call("stats","rnorm","n=100") ... res, err := client.Get(key, "json") ... res, err := client.Rpc("stats","rnorm","n=100","json") ...
Index ¶
- type Call
- type Client
- type Server
- func (s *Server) Call(pkg, fun, args string) (string, error)
- func (s *Server) CallHandler(w http.ResponseWriter, r *http.Request)
- func (s *Server) EnableCaching()
- func (s Server) Get(key, format string) ([]byte, error)
- func (s *Server) GetHandler(w http.ResponseWriter, r *http.Request)
- func (s *Server) RpcHandler(w http.ResponseWriter, r *http.Request)
- func (s *Server) Start(port string) error
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) CallHandler ¶
func (s *Server) CallHandler(w http.ResponseWriter, r *http.Request)
func (*Server) EnableCaching ¶
func (s *Server) EnableCaching()
func (*Server) GetHandler ¶
func (s *Server) GetHandler(w http.ResponseWriter, r *http.Request)
func (*Server) RpcHandler ¶
func (s *Server) RpcHandler(w http.ResponseWriter, r *http.Request)
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func NewSession ¶
func (*Session) InstalledPackages ¶
Click to show internal directories.
Click to hide internal directories.