[R-SIG-Mac] Rserve and plotly

Simon Urbanek @|mon@urb@nek @end|ng |rom R-project@org
Fri Feb 18 00:39:42 CET 2022


htmlwidgets-based code essentially generates html code. In an interactive/local session such code is written into a file and that file is opened by user's browser to display. On a server that obviously doesn't make sense since the user is not on the server, so you have to decide how you want to make the resulting html pages available to the user. Normally, on a server one would use a web-based environment such as RCloud (based on Rserve) which automatically integrates htmlwidgets into the web output. Since you are creating a web-app a natural way is to do something similar.

Probably the easiest way to get started is to call saveWidget() to obtain a fully self-contained html file and serve it to the user. For more complex examples where you have multiple plots and need to take care of integration, serving of JavaScript dependencies etc. - you can have a look at https://github.com/att/rcloud.htmlwidgets for an example how this can be handled since you may need to merge and or/inject the different pieces.


> On Feb 18, 2022, at 7:17 AM, Stavros Panidis <stavros.panidis using gmail.com> wrote:
> Dear,
> I develop a web app where the user can issue a R command and see output in html page. Most of R examples work without any problem.
> When I try plotly commands, in development machine (MacBook Pro) everything goes fine and generated chart opens in new tab.
> The same command has no effect in server (ubuntu 20.04). Both server and development machine run the same version of R (4.1.2) and Rserve (1.8.10)
> Any advice on how to overcome this?
> Many thanks in advance
> Stavros

More information about the R-SIG-Mac mailing list