WebResult is the class of the object that will be returned
run function of a FastRWeb script back to the browser.
Using a separate class allows automatic conversion of other objects
into the necessary representation - all that is needed is a
as.WebResult method for that particular object.
WebResult function can be used to create such objects directly.
as.WebResult coerces an object into a
WebResult, it is a
generic. This allows methods to be defined for
which act as convertors transforming R objects into web results.
1 2 3
string, command passed back to the FastRWeb
interface. Currently supported commands are
string, the body (contents) that will be sent back or file name, depending on the command
MIME content type specification as it will be returned to the browser
string vector, optional additional headers to be sent to the browser. Must not contain CR or LF!
object to convert into
additional arguments passed to the method
There are four ways the results can be passed from R to the client (browser):
"html" is the default mode and it simply sends the
result contained in
payload to the browser as the body of the
"file" sends the content of the file with the name
payload from the
web subdirectory of the
FastRWeb project root as the body of the HTML response.
"tmpfile" sends the content of the file with the name
payload from the
tmp subdirectory of the
FastRWeb project root as the body of the HTML response and removes
the file once it was delivered.
"raw" does not generate any HTML headers but assumes
payload defines the entire HTTP response including
headers. The use of this command is discouraged in favor of
"html" with headers, since the payload must be properly
formatted, which can be difficult.
All modes except
"raw" cause FastRWeb to generate HTML headers
based on the content and any custom headers that were added using
add.header or the
headers argument. Note that
the latter two may NOT contain
Content-type: entries as those are generated automatically
based on the content and the
Object of the class
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.