spin
ning in knitr packageHere is the script generating this html
https://gist.github.com/gists/2975392
#'
).#'
.#+
.spin
it.> library(knitr)
+ spin("script.R")
+ browseURL(normalizePath("script.html"))
The followings will generate
#+ echo = TRUE
mean(rnorm(100))
#+ echo = FALSE
sample(1:10)
this kind of html
mean(rnorm(100))
## [1] 0.1076
## [1] 5 1 10 2 7 6 4 8 9 3
library(ggplot2)
qplot(rnorm(100), rnorm(100), colour = rnorm(100)) +
guides(colour = "colourbar")
xtable
is available for generating html-compatible table from data.frame
.
You need results = "asis"
in chunk option
#+ results = 'asis'
library(xtable)
print(xtable(head(iris)), type = "html")
Sepal.Length | Sepal.Width | Petal.Length | Petal.Width | Species | |
---|---|---|---|---|---|
1 | 5.10 | 3.50 | 1.40 | 0.20 | setosa |
2 | 4.90 | 3.00 | 1.40 | 0.20 | setosa |
3 | 4.70 | 3.20 | 1.30 | 0.20 | setosa |
4 | 4.60 | 3.10 | 1.50 | 0.20 | setosa |
5 | 5.00 | 3.60 | 1.40 | 0.20 | setosa |
6 | 5.40 | 3.90 | 1.70 | 0.40 | setosa |