[英]KnitR , Latex conditional display of Text and Code block
如何根據某些條件打開/關閉特定部分的顯示? 例如,我想僅在xyplotFacSpecTotVarTest.pdf
存在時顯示以下子部分。
我該怎么做 ?
\subsection{Checksum: Factor, Specific, and Total Variance}
Perhaps the most basic test of a regression model is if the factor and specific variances sum to equal the total variance. Here, we
present this diagnostic as an xy-plot, with the sum of factor and specific variance on the x-axis and the total variance on the y-axis. We
expect the plotted points to line up tightly along the identity line.
\clearpage
\begin{figure}[!h]
\centering
\includegraphics{\Sexpr{image_dir}xyplotFacSpecTotVarTest.pdf}
\caption{Total Variance vs. Sum of Factor and Specific Variance, All Instruments Passing Exposure Model.}
\end{figure}
將您的子部分放在另一個文件中,例如sub.Rnw
。 然后有條件地將它包含在主文檔中,例如
<<child = if (file.exists('foo.pdf')) 'sub.Rnw'>>=
@
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.