I am trying to get TeXpad (latest OSX-version) to compile a document with some R code, but just ends up with errors. This is my first try

My document

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\begin{document}
You can type R commands in your \LaTeX{} document and they will be properly run and the output printed in the document.
<<>>=
# Create a sequence of numbers X = 2:10
# Display basic statistical measures summary(X)
@
\end{document}


When compiled with xelatex (or pdflatex) and preprocessed R code, either with Knitr or Sweave, it ends up without the R code being recognised. Is this not possible with TeXpad?

• People might not be familiar with texpad. Does compilation work from a terminal? That is first knitr or sweave of this file, the pdflatex on the output from knitr or sweave – daleif Dec 21 '16 at 9:59