Описание тега r-rook-package

Rook is a web server interface and software package for the language R. For Rook the Kubernetes storage orchestrator use "kubernetes-rook"

Rook is a web server interface and software package for R, similar to Ruby's Rack. It allows to create applications that run on R built-in web server or in rApache. In it's creation it borrowed heavily from Ruby's Rack and it even used the name "Rack" for a while.

A Rook application is an R reference class object that implements a call method or an R closure that takes exactly one argument, an environment, and returns a list with three named elements: status, headers and body.

Examples:

Here is a basic Rook application as a closure:

function(env) {
  body=paste('<h1>Hello World! This is Rook', env$rook.version, '.</h1>')
  list(status=200L,
       headers=list('Content-Type'='text/html'),
       body=body)
}

And the equivalent reference class example:

setRefClass('HelloWorld',
            methods=list(call=function(env) {
                                body=paste('<h1>Hello World! This is Rook', 
                                           env$rook.version, '.</h1>')
                                list(status=200L,
                                     headers=list('Content-Type'='text/html'),
                                     body=body)
                              }))

Resources: