R Language R in LaTeX with knitr R in LaTex with Knitr and Internal Code Chunks


Knitr is an R package that allows us to intermingle R code with LaTeX code. One way to achieve this is internal code chunks. This apporach is demonstrated below.

# r-noweb-file.Rnw
This is an Rnw file (R noweb).  It contains a combination of LateX and R.

print("This is an R Code Chunk")
x <- seq(1:10)
y <- seq(1:10)
plot(x,y)  # Brownian motion