如何在 knitr 中隐藏图形,但将它们创建为 png?
How to hide figures in knitr, but create them as png?
我目前正在使用 R 进行一些统计分析,并使用 knitr
生成结果和概述文档。
还有一些额外的图,我想完成并保存为 .png
(具有指定的文件名和位置),但未包含在生成的 .html
文件中(太多其中,而且还没有排在最后)。
使用 dev.copy(png, ...)
可以很好地生成图表,但数字出现在 .html
中。如果我指定 fig.keep=none
,则会创建 .png
文件,但为空。
有什么方法可以做我想做的事吗?
本文来自knitr website:
fig.show: ('asis'; character) how to show/arrange the plots; four
possible values are
asis: show plots exactly in places where they were
generated (as if the code were run in an R terminal)
hold: hold all
plots and output them in the very end of a code chunk
animate: wrap
all plots into an animation if there are mutiple plots in a chunk
hide: generate plot files but hide them in the output document
fig.show = 'hide'
对我有用。
我目前正在使用 R 进行一些统计分析,并使用 knitr
生成结果和概述文档。
还有一些额外的图,我想完成并保存为 .png
(具有指定的文件名和位置),但未包含在生成的 .html
文件中(太多其中,而且还没有排在最后)。
使用 dev.copy(png, ...)
可以很好地生成图表,但数字出现在 .html
中。如果我指定 fig.keep=none
,则会创建 .png
文件,但为空。
有什么方法可以做我想做的事吗?
本文来自knitr website:
fig.show: ('asis'; character) how to show/arrange the plots; four possible values are
asis: show plots exactly in places where they were generated (as if the code were run in an R terminal)
hold: hold all plots and output them in the very end of a code chunk
animate: wrap all plots into an animation if there are mutiple plots in a chunk
hide: generate plot files but hide them in the output document
fig.show = 'hide'
对我有用。