| out | R Documentation |
out outputs the argument as-is (also works for objects that are
intended for web output)
oprint outputs the result of verbatim print call
otable constructs a table
ohead creates a header
oclear clears (by discarding existing content) the output buffer and/or headers
out(..., sep = "", eol = "\n")
oprint(..., sep = "\n", escape = TRUE)
otable(..., tab = "", tr = "", cs = "</td><td>", escape = TRUE)
ohead(..., level = 3, escape = TRUE)
oclear(output=TRUE, headers=FALSE)
... |
entries to output or print |
sep |
separator string |
eol |
end of line separator |
escape |
if |
tab |
additional attributes for |
tr |
additional attibutes for table row ( |
cs |
column separator |
level |
level of the header (1 is the topmost) |
output |
logical, if |
headers |
logical, if |
The output functions enable the run function to build the
result object gradually as opposed to returing just one
WebResult object at the end.
The output functions above manipulate an internal buffer that collects
output and uses done to contruct the final
WebResult object. It is analogous to using print
to create output in R scripts as they proceed. However, due to the
fact that print output is generally unsuitable as HTML output,
the output function here process the output such that the result is a
HTML document. Special HTML characters '<', '>' and '&' are escaped
in the inner text (not in tags) if escape=TRUE in functions
that provide that argument.
NOTE: It is important to remember that the output is collected in a
buffer, so in order to actually create the output, do not forget to use
return(done()) when leaving the run function to use that
content!
All functions returns the full document as constructed so far
done, WebResult
run <- function(...) {
ohead("My Table", level=2)
d <- data.frame(a = 1:3, b = c("foo", "bar", "foobar"))
otable(d)
out("<p><b>Verbatim R output:</b><br>")
oprint(str(d))
done()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.