I'm learning to use R/Sweave/LaTeK to write my stat reports. Is there a way to have an executive summary in the beginning while still having the analysis code embedded? For example, a study has three independent objectives so I want my report to have three sections. Ideally the code chunk that answers the first objective would be embedded in the first section and so on. However I want a table that summarizes the results from all three objectives at the beginning of the report. Is there a way to generate a summary after the three sections but tell LaTeK to publish it first? Possibly by rearranging the sections/pages? Currently I'm doing all the coding in a big block up front but that waste much of the advantage of weaving to me. If the right answer is 'post to a latek board' I'd be happy to get that feedback as well. Thank, Karen _________________________________________________________________ ******************************************************************* IMPORTANT MESSAGE FOR RECIPIENTS IN THE U.S.A.: This message may constitute an advertisement of a BD group's products or services or a solicitation of interest in them. If this is such a message and you would like to opt out of receiving future advertisements or solicitations from this BD group, please forward this e-mail to optoutbygroup at bd.com. *******************************************************************This message (which includes any attachments) is intended only for the designated recipient(s). It may contain confidential or proprietary information and may be subject to the attorney-client privilege or other confidentiality protections. If you are not a designated recipient, you may not review, use, copy or distribute this message. If you received this in error, please notify the sender by reply e-mail and delete this message. Thank you. ******************************************************************* Corporate Headquarters Mailing Address: BD (Becton, Dickinson and Company) 1 Becton Drive Franklin Lakes, NJ 07417 U.S.A. *******************************************************************
Hi Karen, Once you've run your .Rnw file once, and (say) assigned the output of a lm(y ~ x) to m1, you can add your summary at the beginning of your .Rnw file and output quantities such as the intercept (to be produced "later") using $\Sexpr{round(as.numeric(coef(m1)[1]), 3)}$ (it's a good idea to have the $$ because otherwise minus signs will print as hyphens). This is the case that the object m1 will still be available at the beginning of the next run. This is not perfect, b/c if later, during a different R session, you want to run the Rnw file through again, you'll have to remove the \Sexpr{} in your summary until the second run. So you can keep two versions of your Rnw file, a short one for the first run, and a longer one for the second. On Apr 15, 2009, at 1:47 PM, Karen_Byron@bd.com wrote:> > I'm learning to use R/Sweave/LaTeK to write my stat reports. Is > there a way > to have an executive summary in the beginning while still having > the > analysis code embedded? For example, a study has three > independent > objectives so I want my report to have three sections. Ideally > the code > chunk that answers the first objective would be embedded in the > first > section and so on. However I want a table that summarizes the > results from > all three objectives at the beginning of the report. Is there a > way to > generate a summary after the three sections but tell LaTeK to > publish it > first? Possibly by rearranging the sections/pages? > Currently I'm doing all the coding in a big block up front but > that waste > much of the advantage of weaving to me.HTH, MK _____________________________ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box 400400 Charlottesville, VA 22904-4400 Parcels: Room 102 Gilmer Hall McCormick Road Charlottesville, VA 22903 Office: B011 +1-434-982-4729 Lab: B019 +1-434-982-4751 Fax: +1-434-982-4766 WWW: http://www.people.virginia.edu/~mk9y/ [[alternative HTML version deleted]]
<Karen_Byron <at> bd.com> writes:> I'm learning to use R/Sweave/LaTeK to write my stat reports. Is there a way > to have an executive summary in the beginning while still having the > analysis code embedded?Thanks to Ulrich Dietz from the German latex forum, I have an excellent solution that can write summaries (for the top) and appendixes. It is pure latex, but it main power comes when using it with rnw/Sweave. <http://groups.google.de/group/de.comp.text.tex/browse_thread/thread/8830a37d45dfca8e/5b3c72557b10e32b> The idea is to have sections that are written out to a file similarly to bibtex, and are collected later. You can download a minimal self- running example from http://www.menne-biomed.de/uni/appcol2.tex (Make sure that you do not ask any more latex related questions here, you are running the risk of receiving a flame mail by higher authorities) % -------- incomplete example ----- \begin{document} \section{first section} First paragraph. \printsummary % Does what is says <<results=tex>>. cat("This is main text") @ \begin{appendx} % appendix was taken <<results=tex>>. cat("This goes to appendix") @ \end{appendx} \begin{summary} <<results=tex>>. cat("This goes to summary") @ \end{summary} <<results=tex>>. cat("Another main text") @ \printappendix \end{document}