summaryrefslogtreecommitdiff
path: root/samples/brew.brew
blob: f61a87c1d476e3ac191474b29a59143df493d406 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
-*- mode: poly-brew+R; -*-

We know the value of pi is <% pi %>, and 2 times pi is <% 2*pi %>.

The brew syntax in knitr is similar to the brew package, but all kinds of
syntax in the brew package will be treated in the same way in knitr: they are
nothing but inline R code.

<% x<-1.234; NULL %>

You can write a number as <% x %>, or <%= x %>, or <% x -%>.

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. -%>

How about generating a template from a template?  <%% foo <- ’fee fi fo fum’ %%>
foo is still <%=foo%>.