Hi Michael, Michael Weylandt <michael.weyla...@gmail.com> writes:
> Hi, > > I want to put a summary of my analysis at the beginning of a document > using results calculated at the end of the document. Is this possible? > > #========= > #+TITLE: Test > #+AUTHOR: Michael Weylandt > #+PROPERTY: header-args:R :session *__R__* :exports both > > * Summary > The mean result was src_R[:exports results]{mean(x)} > > * Analysis, > We do some complicated calculations: > > #+BEGIN_SRC R > x <- rnorm(5) > #+END_SRC > #========= > > Is this possible in a single pass? I've played with #+NAME and > <<block()>> but haven't gotten the out-of-order evaluation quite > right. > > Michael > How about something along: --8<---------------cut here---------------start------------->8--- #+TITLE: Test #+AUTHOR: Michael Weylandt #+PROPERTY: header-args:R :session *__R__* :exports both * Summary The mean result was src_R[:exports results :var analysisresults=theanalysis()]{mean(unlist(analysisresults))} * Analysis, We do some complicated calculations: #+name: theanalysis #+BEGIN_SRC R x <- rnorm(5) #+END_SRC --8<---------------cut here---------------end--------------->8--- Regards, Andreas