Questions tagged [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:

24 questions
1
vote
2 answers

How can I serve html pages in R?

I have a folder with html files and I want to start a simple HTTP server that serves the requested file. I have been trying to use Rook, but it asks for an app function that generates the HTML response. library(Rook) server <-…
nachocab
  • 13,328
  • 21
  • 91
  • 149
1
vote
1 answer

Custom HTTP Handler using Rook

I am building this app using the Rook package in R: library(Rook) s <- Rhttpd$new() s$start(quiet=T) PIC.DIR = paste(getwd(), 'pic', sep='/') my.app <- function(env){ ## Start with a predefined lognormal mean and median, and allow a user to…
user1445246
  • 303
  • 4
  • 14
1
vote
1 answer

Populating an HTML dropdown box with an R vector

I am playing around with Rook and googleVis in an attempt to produce some interactive charts I currently have an HTML text box where users can input a date to trigger changes res <- Rook::Response$new() res$write('
pssguy
  • 3,455
  • 7
  • 38
  • 68
1
vote
1 answer

Error message trying to include ggplot2 chart with Rook

The following code uses Rook to build a very simple webapp for plotting a stock candle chart built with ggplot2. It follows the same pattern as the original example by Jeff Horner. The error message I get in my RStudio when I execute the script…
Andrew Dempsey
  • 190
  • 1
  • 12
0
votes
1 answer

Parsing POST body in R Rook

I would like to get the raw text of a POST request's body using the R web server package Rook. I have registered the R app: parsePOST <- function(env) { request <- Rook::Request$new(env) body <- request$body() …
Shoeboxam
  • 43
  • 1
  • 5
0
votes
1 answer

Deploy Rook Apps in R internal web server

I develop a Rook Apps and it works perfectly . so i want to deploy under Rstudio with different IP and PORT: so i use the code of jeffrey horner : http://jeffreyhorner.tumblr.com/post/33814488298/deploy-rook-apps-part-ii But, doesn't work! with…
0
votes
0 answers

Using gWidgetsWWW2 with googleVis

How can one go about using googleVis charts with gWidgetsWWW2? I have seen that it is possible to use googleVis with Rook (http://www.magesblog.com/2012/08/rook-rocks-example-with-googlevis.html and…
jav
  • 1,485
  • 8
  • 11
0
votes
1 answer

Rook webserver parses content of postfields into name of list

I want to send an xml string to my Rook web server. But when I use the POST method of the Rook::Request class to parse the POST payload of my request, it puts the content into the name of the returned list. The corresponding list value is NA. I use…
cryo111
  • 4,444
  • 1
  • 15
  • 37
-2
votes
1 answer

Rook error: Error in inherits(app, "RhttpdApp")

I have some apps which have been running into my office for weeks. In the last days, sometimes, I receive in the R console the following message: Error in inherits(app, "RhttpdApp") : no function to return from, jumping to top level Do you know…
Michele
  • 8,563
  • 6
  • 45
  • 72
1
2