In this example, we show how to use knitr with
Textile.
The syntax for defining code blocks is similar to that of HTML or AsciiDoc.
You just use ###.
followed by begin.rcode
or end.rcode
, and then
additional options like a name for the chunk and figure settings.
if (1 + 1 == 2) {
'of course!'
}
## [1] "of course!"
Some other examples:
x = cumsum(rnorm(100))
mean(x)
## [1] 2.473
plot(x, pch = 20, type = "o", col = "red")
A random walk.
1:3 + 1:2
## Warning in 1:3 + 1:2: longer object length is not a multiple of shorter
## object length
## [1] 2 4 4
1 + "a"
## Error in 1 + "a": non-numeric argument to binary operator
And an inline expression 6.2832
.
That’s about it!