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
11
votes
1 answer

Getting the private ip address of an Rook/Shiny page user

I have created some web app using Rook which listen to my network ip (192.168.xx.xx) at port 8000. Everyone inside my office can connect to them just typing http://192.168.xx.xx:8000/page_name in the browser. I need to monitor these pages usage and…
Michele
  • 8,563
  • 6
  • 45
  • 72
7
votes
2 answers

Run R/Rook as a web server on startup

I have created a server using Rook in R - http://cran.r-project.org/web/packages/Rook Code is as follows #!/usr/bin/Rscript library(Rook) s <- Rhttpd$new() s$add( name="pingpong", app=Rook::URLMap$new( '/ping' = function(env){ req <-…
Vineeth Mohan
  • 18,633
  • 8
  • 63
  • 77
6
votes
1 answer

Upload multiple files with Rook

The HTML5 specification allows multiple files to be uploaded at once via . Is there a way to take advantage of this with the Rook R package? Here's my attempt, but it seems to only show one of the…
Joshua Ulrich
  • 173,410
  • 32
  • 338
  • 418
6
votes
1 answer

passing file name to R from javascript using Rook package

In a R functon, i used fileName as parameter to read and process the csv data present in that file. I used rook package to integrate R with javascript. In javascript i used the following code to get the file name of the imported file.
Dinoop Nair
  • 2,663
  • 6
  • 31
  • 51
5
votes
1 answer

RStudio : Rook does not work?

I would like to build a simple webserver using Rook, however I am having strange errors when trying it in R-Studio: The code library(Rook) s <- Rhttpd$new() s$start() print(s) returns the rather useless error "Error in listenPort > 0 : …
Christian Sauer
  • 10,351
  • 10
  • 53
  • 85
5
votes
1 answer

Managing POST Requests with httpuv package for building a simple API with R

I am trying to build a simple api using httpuv package. The documentation says that one could use the same Rook definition. While using the Rook package one can simple use: req$POST() I haven't been able to figure out how to manage simple HTTP…
jpmarindiaz
  • 1,599
  • 1
  • 13
  • 21
5
votes
0 answers

R Rook webserver

How can I let the R Rook webserver allow remote connections ? > library(Rook) Loading required package: tools Loading required package: brew > s <- Rhttpd$new() > s$start() done Server started on host 127.0.0.1 and port 18445 . App urls are: …
MadSeb
  • 7,958
  • 21
  • 80
  • 121
4
votes
2 answers

Deploying an R app with a GUI

I developed an R application and I want to deploy it. Currently the application consists of a set of functions to be run from the command line, like an R package. In order to deploy it, I am thinking of repackaging R Portable adding the necessary…
antonio
  • 10,629
  • 13
  • 68
  • 136
2
votes
1 answer

How do you control the lifetime of a Rook server?

I am new to R and to Rook. I am able to successfully run Rook in a browser when I run from RTerm or from RStudio. However, when I run from RScript I get connection refused. My guess is that RScript runs my script and exits the script. So how would I…
Chet Murphy
  • 51
  • 1
  • 3
2
votes
1 answer

Add an image into an Rook web app using css

I have the following code which should produce a simple page with an image as background r <- matrix(runif(9, 0, 1), 3) g <- matrix(runif(9, 0, 1), 3) b <- matrix(runif(9, 0, 1), 3) col <- rgb(r, g, b) dim(col) <-…
Michele
  • 8,563
  • 6
  • 45
  • 72
2
votes
0 answers

Errors in Deploying Rapache and Rook

I am trying to create a web application using R and Rook. I saw this example http://www.road2stat.com/cn/r/rook.html and I have been able to replicate it in my command line (Calling it from inside R). But I want multiple users to be able to connect…
Tony
  • 31
  • 1
  • 4
1
vote
0 answers

Working with data using R Rook package

Does anyone know how to add data table, run some algorithm and save answer using R Rook application? I have a problem reading data in my application. Where I should write data <- read.csv(file = "BASE_CASE.csv" ) in Rook.app_2 function or in…
Kirill1994
  • 11
  • 1
1
vote
1 answer

Rook error: unused arguments

> library(Rook) > s <- Rhttpd$new() > s$add(name='MyApp',plot_ind_brz='D:/STOCK/plot_ind_brz.R') I am getting an error "Error in s$add(name = "MyApp", plot_ind_brz = "D:/STOCK/plot_ind_brz.R") : unused argument(s) (plot_ind_brz =…
user2969490
  • 135
  • 1
  • 1
  • 5
1
vote
0 answers

How to integrate Rook Classes and httpuv

I am trying to run some Rook Classes (such Middleware, builder, Brewery and file) with httpuv, knowing that web application is "implemented in accordance with the Rook specification." ( from httpuv documentation ). However, it seems that not all…
GeoObserver
  • 128
  • 6
1
vote
1 answer

R: Scheduling code in a webpage

I'm trying to build a webpage displaying a few graphs. I want to use R to build the graphs, and I want these graphs to automatically update themselves periodically. For example, a webpage showing a graph of the stock price of a particular company…
user2037187
  • 75
  • 1
  • 6
1
2