Description Usage Arguments Details Value Author(s) See Also Examples
brew
provides a templating system for text reporting. The syntax is similar to PHP,
Java Server Pages, Ruby's erb module, and Python's psp module.
1 |
file |
A connection, or a character string naming the file to read from. stdin() is the default. |
output |
A connection, or a character string naming the file to print to. stdout() is the default. |
text |
A character string treated as if it contained lines of a file
to read from. Only one of |
envir |
the |
run |
Logical to determine if |
The following template contains syntax to exercise all brew
functionality:
1 2 3 4 5 6 7 8 9 10 11 12 | ---------------
You won't see this R output, but it will run. <% foo <- 'bar' %>
Now foo is <%=foo%> and today is <%=format(Sys.time(),'%B %d, %Y')%>.
<%# Comment -- ignored -- useful in testing.
Also notice the dash-percent-gt.
It chops off the trailing newline.
You can add it to any percent-gt. -%>
% cat("and R one-liner\n")
How about generating a template from a template?
<%% foo <- 'fee fi fo fum' %%>
foo is still <%=foo%>.
---------------
|
The output is:
1 2 3 4 5 6 7 8 | --------------
You won't see this R output, but it will run.
Now foo is bar and today is April 20, 2007.
and R one-liner
How about generating a template from a template?
<% foo <- 'fee fi fo fum' %>
foo is still bar.
--------------
|
When run=TRUE
, the result of the last evaluated expression after brewing the input.
When run=FALSE
, the parsed expressions after brewing the input.
Jeffrey Horner <jeff.horner@vanderbilt.edu>
Sweave
for the original report generator.
1 2 3 4 5 6 7 8 9 | ## Don't sully up environment, so use envir=new.env(). Nested brew calls will still work.
brew(system.file("example1.brew",package="brew"),envir=new.env())
## Various ways to print R output
brew(system.file("catprint.brew",package="brew"),envir=new.env())
rm(iris)
## The example from the Details section
brew(system.file("featurefull.brew",package="brew"),envir=new.env())
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.