Description Usage Arguments Details Examples
There are two basic tasks that gWidgetsWWW2 does: a) create the javascript to populate a page (or part of the page) and b) create a means for AJAX requests between the web browser and the R process. For b) there isn't much to say except that it is supposed to just work.
1 2 3 |
script_name |
path to gWidgetsWWW2 script |
app_name |
base name for script, unique per project. Derived from script name if not specified. |
port |
Initial port for Rhttpd server, provided it hasn't already started. |
session_manager |
an instance of |
open_page |
logical. If |
show.log |
If TRUE, logged information is written to the console. |
... |
Passed to WebPage object. Named arguments
|
As for a) there are things one can pay attention to. The simplest case is really pretty simple. Write some script, save it to a file and call this function with the script name (and path if needed). This simple case will create a full screen app. Each app runs in its own environment in the R session, so running lots of instances can be expensive. That is, don't expect gWidgetsWWW2 to scale.
To embed an app within a web page, use an iframe
tag.
1 2 3 | ## open an app that takes the entire page
gw_script <- system.file("examples/ex-hello-world.R", package="gWidgetsWWW2")
if(interactive()) load_app(gw_script, "HelloApp")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.