UPDATE: it seems my question is actually a very close duplicate of this question
and there is currently no “easy” solution to this thread. However, this issue has been around for more than a year, and time may change (hopefully!).
My initial question is:
I think I need some mechanism to reorder the text and Rpieces in the document, as it knits. What I want to do is to write an “article” style document with an abstract and summary description at the beginning, before I get into any code R, but which contains “forward” links to things that will be calculated in the code R.
So my resume at the beginning may be
We found a `r final_correlation / 100`% correlation between x and y ...
but "final_correlation" will be calculated at the end of the document when I go through all the steps of the reproduced study.In fact, when I read about reproducible research, I often see comments that documentation can often be better represented outside the programming sequence.
I believe that in other literate programming systems, pieces can be confused in a different order from the one in which they were presented. How can I achieve this in knitr? Or is there some other completely different workflow or template that I could take to achieve the desired result?