ramnathv / rNotebook

A browser based R Notebook
http://ramnathv.github.io/rNotebook
125 stars 30 forks source link

Launching from bat file: Error in AppWrapper$new : could not find function "loadMethod" #11

Closed benmarwick closed 11 years ago

benmarwick commented 11 years ago

This is a great app, and I'm excited to see it get closer to IPython (there's already an IJulia!), thanks for making it available.

I have a Windows batch file that I want to launch rNotebook in firefox:

%= rNotebook launcher =%
set R_Script="C:\Program Files\R\R-3.0.2\bin\x64\RScript.exe"
pause
%R_Script%  -e "rNotebook::viewNotebook()"
pause
CD C:\Program Files\Mozilla Firefox\
start firefox.exe http://localhost:7141/
%= end =%

Here's what I get:

Loading required package: shiny

Listening on port 3900
Error in AppWrapper$new : could not find function "loadMethod"
Calls: <Anonymous> ... <Anonymous> -> startAppDir -> startApp -> startServer ->
$
Execution halted

And nothing happens.

Any tips on how to overcome this? I'm on Windows 7 with R 3.0.2

thanks,

Ben

ramnathv commented 11 years ago

Does it work for you if you just run rNotebook::viewNotebook() from your R console?

benmarwick commented 11 years ago

Thanks, yes, that line works great. That's the step I'm attempting to bypass.

ramnathv commented 11 years ago

It is an Rscript related issue. You will find a discussion here, along with a potential solution directly using R instead of Rscript.

benmarwick commented 11 years ago

Thanks for the pointer, the solution was there as you indicated. This works great as a windows batch file to open rNotebook without using R directly:

%= rNotebook launcher =%

start firefox.exe http://localhost:3838/

Rscript --no-save --no-restore -e "library(methods); shiny::runApp('C:/emacs/R/win-library/3.0/rNotebook/notebook', launch.browser=FALSE, port = 3838)"

%= end =%

thanks again!