The knitr package (Xie 2014) is an alternative tool to Sweave based on a different design with more features. This document is not an introduction, but only serves as a placeholder to guide you to the real manuals, which are available on the package website http://yihui.name/knitr1, and remember to read the help pages of functions in this package. There is a book (Xie 2013) for this package, but it may not be useful to those who prefer digging out information on the web.
Anyway, here is a code chunk that shows you can compile vignettes with knitr as well using R 3.0.x, which supports non-Sweave vignettes:
rnorm(5)
## [1] 0.5775 0.4042 0.6726 0.2836 1.1780
df = data.frame(y = rnorm(100), x = 1:100)
summary(lm(y ~ x, data = df))
##
## Call:
## lm(formula = y ~ x, data = df)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.553 -0.731 0.115 0.764 2.390
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.18254 0.22023 0.83 0.41
## x -0.00393 0.00379 -1.04 0.30
##
## Residual standard error: 1.09 on 98 degrees of freedom
## Multiple R-squared: 0.0109, Adjusted R-squared: 0.000808
## F-statistic: 1.08 on 1 and 98 DF, p-value: 0.301
Xie, Yihui. 2013. Dynamic Documents with R and Knitr. Chapman; Hall/CRC. http://yihui.name/knitr/.
———. 2014. knitr: A General-Purpose Package for Dynamic Report Generation in R. http://yihui.name/knitr/.
e.g. the main manual and the graphics manual↩