With knitr, preserve chunk options when purling chunks into separate files
问题 For teaching purposes, I would like to purl the chunks of my .Rnw file into separate files. This answer explains how to do it: How to purl each chunks in .Rmd file to multiple .R files using Knitr BUT the method does not preserve the chunk options. Since the chunks I have produce plots, it's important to preserve the fig.width and fig.height options. Ideally I would like a chunk that looks like this: <<plot, fig.width = 3, fig.height = 5, outwidth = '.75\\textwidth'>>= plot (1,1) @ to become