Using knitr to produce complex dynamic documents
问题 The minimal reproducible example (RE) below is my attempt to figure out how can I use knitr for generating complex dynamic documents , where "complex" here refers not to the document's elements and their layout, but to non-linear logic of the underlying R code chunks. While the provided RE and its results show that a solution , based on such approach might work well, I would like to know : 1) is this a correct approach of using knitr for such situations; 2) are there any optimizations that