I am writing a Sweave document, and I want to include a small section that details the versions of R and the package, platofrms and how long it took to evaluate the level of detail, however I want to put this in the middle of the document!
I used \ Sexpr {elapsed} to do this (it didn’t work), but thought that if I put the code print passed in the piece that is evaluated at the end, I could then add the piece halfway, which also fails.
My document looks something like this.
% \documentclass[a4paper]{article} \usepackage[OT1]{fontenc} \usepackage{longtable} \usepackage{geometry} \usepackage{Sweave} \geometry{left=1.25in, right=1.25in, top=1in, bottom=1in} \begin{document} <<label=start, echo=FALSE, include=FALSE>>= startt<-proc.time()[3] @ Text and Sweave Code in here % This document was created on \today, with \Sexpr{print(version$version.string)} running on a \Sexpr{print(version$platform)} platform. It took approx sec to process. <<>>= <<elapsed>> @ More text and Sweave code in here <<label=bye, include=FALSE, echo=FALSE>>= odbcCloseAll() endt<-proc.time()[3] elapsedtime<-as.numeric(endt-startt) @ <<label=elapsed, include=FALSE, echo=FALSE>>= print(elapsedtime) @ \end{document}
But this does not work (amazing!)
Does anyone know how I can do this?
thanks
Paul.
source share