With the following file
\documentclass{article}
\begin{document}
\begin{figure}[htb]
\centering
<<fig=FALSE,echo=FALSE>>=
png("test0.png",width=4,height=4,units='in',res=1200)
plot(1)
dev.off()
@
\includegraphics{test0.png}
\caption{Demonstration}
\end{figure}
there is a null device 1
message that appears before the plot
It is the output of the R commands that generate the plot.
You can suppress it by adding results=hide
.
<<fig=FALSE,echo=FALSE,results=hide>>=
Your message is slightly different because dev.off()
returns the name of the current device:
there was none in my case (it was a fresh session),
and a previously opened (but not closed) PDF file in your case.