I'm a little lost with the knitr package. I love the spin() function to quickly give me a global view of my analyses, but I need to save some very important plots in separate pdf (by example the 8th plot of my file should be save as "Figure1.pdf" AND displayed in the report).
When I write :
Some random code and plots...
pdf('Figure1.pdf')
plot(important plot)
dev.off()
Some random code and plots
The important plot is not displayed in the report after a spin(), and I would like to be in the report AND the pdf.
Is there any way ?
Thanks
spin
creates. By starting a PDF device you've usurped that, so you don't get a PNG. I can't think how to generate both PDF and PNG without hooking into knitr's graphics at a low level, which might be possible. – Spacedmandev
accepts a vector, so you can tell knitr to produce both pdf and png for any given chunk – baptiste