5
votes

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 : comparison (6) is possible only for atomic and list types".

When trying the same code in a simple R-Console,everything works - so I would like to understand why that happens and how I can fix it.

RStudio is Version 0.99.484 and R is R 3.2.2

1
The httpuv package has an implementation of the Rook spec which works much better than the original. Try webutils::demo_httpuv() for a quick demo of how to use it.Jeroen Ooms

1 Answers

7
votes

I've experienced same thing.

TLDR: This pull request solves the problem: https://github.com/jeffreyhorner/Rook/pull/31


RStudio is treated in different way and Rook port is same as tools:::httpdPort value. The problem is that in current Rook master tools:::httpdPort is assigned directly. It's a function that's why we need to evaluate it first.


If you want to have it solved right now, without waiting for merge into master: install devtools and load package from my fork @github.

install.packages("devtools")
library(devtools)
install_github("filipstachura/Rook")