dfrankow
dfrankow

Reputation: 21387

Including a Sweave document in R studio?

I created two files Master.Rnw and Child.Rnw as in this documentation. To wit:

Master.rnw:

\documentclass{article}
\begin{document}
\SweaveOpts{concordance=TRUE}

\section{Overview}
This is the overview.

\SweaveInput{Child.Rnw}

\end{document}

Child.Rnw:

% !Rnw root = Master.Rnw

\section{Analysis}
This is the analysis.

<<analysis>>=
summary(cars)
@

I click "Compile PDF" and get "Undefined control sequence" for \SweaveOpts and \SweaveInput.

I'm using the latest R Studio (0.98.490).

Suggestions?

Upvotes: 1

Views: 256

Answers (1)

dfrankow
dfrankow

Reputation: 21387

The project was set to weave using knitr instead of Sweave.

I went to Tools / Options / Sweave / "Weave Rnw files using" and changed it to Sweave.

That got the documented example to work.

Upvotes: 2

Related Questions