Can not (failed) compile a pdf from a sweave document . Rnw

Hello, can somebody please give me an advise how to compile a pdf from .Rnw?

I have a Windows 7 64-bit system, RStudio Version 1.4.1106, Texmaker version 5.0.4, R version x64 4.0.2 and MikTex Console version 4.2.

I am new to all this.
I am trying to compile this document (my basic document):

\documentclass{article}
\title{My first Sweave document}
\author{Author}

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

<<echo=FALSE>>=
library(xtable)
@
\maketitle

text

<<First try, echo=F>>=
x<-2
x
@
text text text \sexpr{mean(x)}.

<<Graph,fig=TRUE,include=FALSE>>=
x<--10:10
y<-x^2-x
plot(y-x,type="l")
@
\end{document}

...When I run it, everything is fine, the graph and everything is working, but when I want to compile a pdf , it always shows this error:
Running pdflatex.exe on Skuska3.tex...failed
Error running C:/PROGRA~1/MiKTeX/miktex/bin/x64/pdflatex.exe (exit code 3).

I tried to open the .tex file of this document in Tex maker, but it showed another error : ! LaTeX Error: File `Sweave.sty' not found.
I found "Sweave.sty" file in another subfolder, I added a path to this file in MikTex console but it did not help.
I have tried many solutions, but none of them worked.

Thank you for any help you can provide!

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.