0

After upgrading R to version 3.1.0 (from some version 2.x.x), the following sweave code does not produce any pdfs for the plots anymore:

\documentclass[a4paper,10pt]{article}
\SweaveOpts{echo=FALSE}

\begin{document}

\begin{figure}
\begin{center}
<<fig = T, echo = F, include=T>>=
x=rnorm(100)
plot(x)
@
\caption{My Graph}
\end{center}
\end{figure}

\end{document}

To compile, I use R CMD Sweave foo.Rnw followed by R CMD pdflatex foo.tex. Why is that and how can I fix it? I played around with the options: fig = TRUE, pdf = TRUE and so on - to no avail.

Edit: Here is the output of R CMD Sweave foo.Rnw, which should create the pdf files:

R CMD Sweave foo.Rnw
stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this.
Output file:  foo.tex
R CMD pdflatex foo.tex
....
5
  • Did you re-install ggplot2 for R version 3? – Thruston Jul 29 '14 at 10:32
  • Your example works for me after upgrading to the latest R - but only after I had re-installed ggplot2 and all of its dependencies. – Thruston Jul 29 '14 at 10:43
  • @Thruston: sorry, the ggplot library is actually not needed. Even when using the standard plot-function, no pdfs are generated. – mort Jul 29 '14 at 11:12
  • Do you get any error messages? – Thruston Jul 29 '14 at 11:21
  • No. I'll add the output of the first command to my question. – mort Jul 29 '14 at 11:25
0

I updated R to version 3.1.1 (by removing R 3.1.0 and installing R 3.1.1 from source) - and voila, it works!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.