# R Sweave does not compile to PDF

I have installed MikTex and Rstudio to use R sweave. I wrote the most basic code on R sweave. I have used it on another Windows laptop but while using it on another windows laptop in the exact same manner, it does not compile the PDF. They are both Windows 10, 64-bit systems. This is my code:

\documentclass{article}

\begin{document}
\SweaveOpts{concordance=TRUE}
Hello WOrld!

\end{document}


This the end error that it returns if I set Weaver to Sweave in Global options:

Writing to file s2.tex Processing code chunks with options ...

You can now run (pdf)latex on 's2.tex' Running pdflatex.exe on s2.tex...failed Error running C:/Users/HPAIO~1/AppData/Local/Programs/MiKTeX/miktex/bin/x64/pdflatex.exe (exit code -1073740791)

If Weaver is set to knitr, then error is this: Loading required package: knitr

processing file: s2.Rnw |......................................................................| 100% ordinary text without R code

output file: s2.tex

[1] "s2.tex" Warning message: In remind_sweave(if (in.file) input, sweave_lines) : It seems you are using the Sweave-specific syntax in line(s) 4; you may need Sweave2knitr("s2.Rnw") to convert it to knitr Running pdflatex.exe on s2.tex...failed Error running C:/Users/HPAIO~1/AppData/Local/Programs/MiKTeX/miktex/bin/x64/pdflatex.exe (exit code -1073740791)

When I click of "View Log", it shows a pop up of "The system cannot find the file specified"

The only difference I see between the computer that ran sweave without issues is that \SweaveOpts {Concordance=TRUE} was not a default line there. But I do not know what that implies, if anything.

Thanks in anticipation.

• You cannot use \SweaveOpts {Concordance=TRUE} with knitr, it is only for Sweave. This line is not generated in the another computer because it use knitr by default.
– Fran
Feb 5, 2021 at 10:04

• Ribnikov's solutions worked. I kept install packages on the fly and removed \SweaveOpts {Concordance=TRUE while weaving using knitr in the global settings. Thanks to both! Feb 9, 2021 at 8:40