out.Rdout 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
separator string
end of line separator
if TRUE special HTML characters are escaped in
inner text (via `FastRWeb:::htmlEscape`), if FALSE the
strings are passed without modification. It can also be a function
taking exactly one argument that is expected to perform the escaping.
additional attributes for table HTML tag
additional attibutes for table row (tr) HTML tag
column separator
level of the header (1 is the topmost)
logical, if TRUE then the output is cleared
logical, if TRUE then the headers are cleared
All functions returns the full document as constructed so far
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!
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()
}