I have a plot with millions of datapoints, so I am looking to first make a png
then include it. However, I've run into the problem of not being able to include png
when I go to compile time.
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}[htb]
<<fig=TRUE,echo=FALSE>>=
png('test.png')
plot(rnorm(100))
dev.off()
@
\includegraphics{test}
\end{figure}
\end{document}
After calling the above MWE I will then go to my R
console just like usual and call:
Sweave("report.Rnw")
texi2pdf("report.tex")
Which works all the time unless I have the above code in my Rnw
file. The error message:
Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet, :
Running 'texi2dvi' on 'report.tex' failed.
LaTeX errors:
!pdfTeX error: pdflatex (file ./report-019.pdf): PDF inclusion: requir
ed page does not exist <0>
==> Fatal error occurred, no output PDF file produced!
> Sweave("report.Rnw") ; texi2pdf("report.tex")
Writing to file report.tex