I have a collection of old .Rnw
files from ~2015 that were largely based on .tex
files for Beamer presentations. I used knitr
mainly to include R
code & output where needed, translate Rnw -> tex & then compile to PDF. This all worked within R Studio at the time. It doesn't now, and I can't figure out why not or how to fix it.
One such file .Rnw
begins like this:
\documentclass[10pt,table]{beamer}
\input{inputs/beamer-setup}
\input{inputs/defs}
<<echo=FALSE>>=
source("Rprofile.R")
knitrSet("CFA-SEM")
@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
...
In R Studio now, I click on Compile PDF
, but I get the error message:
(chunk 1) Argument is of length zero
Do I have to change all chunks from the old style to the new style,
```{r echo=FALSE}
...
```
I'm not sure exactly what Compile PDF
does in R Studio. What are commands I can use to find out what the problem is and how to correct it?
Edit Here is a complete MWE:
\documentclass[10pt,table]{beamer}
%\input{inputs/beamer-setup}
%\input{inputs/defs}
\renewenvironment{knitrout}{\renewcommand{\baselinestretch}{.9}}{}
<<echo=FALSE>>=
source("Rprofile.R")
knitrSet("CFA-SEM")
#.locals$chXX <- NULL
@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\SweaveOpts{concordance=TRUE}
%\SweaveOpts{concordance=TRUE}
\title[CFA \& SEM]{Confirmatory Factor Analysis\\ \& Structural Equation Models}
\subtitle{Lecture 1: Overview \& Path Analysis}
\author{Michael Friendly}
\date[SCS] % (optional)
{SCS Short Course, May, 2019}
\begin{frame}[plain]
\titlepage
\end{frame}
\end{document}
In the output I get:
Writing to file testing1.tex
Processing code chunks with options ...
1 : keep.source term verbatim (testing1.Rnw:9)
Loading required package: knitr
Error: chunk 1
Error in if (format == "latex") { : argument is of length zero
Execution halted