1
如果我寫含有例如像圖簡單RNW文件,knitr和Sweave PDF文件名編號爲
\documentclass[11pt]{article}
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<<setup, include=FALSE, cache=FALSE>>=
opts_chunk$set(dev = "pdf", comment = NA, fig.path = "figure/", fig.align='center', cache=FALSE, message=FALSE, background='white')
options(replace.assign=TRUE,width=85, digits = 8)
knit_hooks$set(fig=function(before, options, envir){if (before) par(mar=c(4,4,.1,.1),cex.lab=.95,cex.axis=.9,mgp=c(2,.7,0),tcl=-.3)})
@
<<prepare-data, include=FALSE>>=
@
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\begin{document}
A simple plot
\begin{figure}
<< scat, echo = FALSE, fig.width = 4.5, fig.height=3>>=
plot(runif(10), runif(10), pch = 20)
@
\end{figure}
\end{document}
爲什麼現在knitr創建一個PDF文件figure/scat-1.pdf
而不是figure/scat.pdf
?
非常感謝你一回!我猜,但無法找到信息。 – 2014-10-28 08:58:48