Hi all I'm having a problem when using Sweave. Here is a minimal example.
My input file (eg, test.Snw) looks like this: <<TESTME,echo=FALSE, results=hide,fig=FALSE,keep.source=TRUE>>= data(cars) m1 <- lm( dist~speed, data=cars ); coef( m1 ) @ <<echo=TRUE,results=verbatim,fig=FALSE,keep.source=TRUE>>= <<TESTME>> @ <<TESTME2,echo=FALSE, results=hide,fig=FALSE,keep.source=TRUE>>= data(cars) m1 <- lm( dist~speed, data=cars ) @ <<echo=TRUE,results=verbatim,fig=FALSE,keep.source=TRUE>>= <<TESTME2>> @ After running Sweave over this file in R, the output file (eg. test.tex) looks like this: \begin{Schunk} \begin{Sinput} > data(cars) > m1 <- lm( dist~speed, data=cars ); coef( m1 ) > m1 <- lm( dist~speed, data=cars ); coef( m1 ) \end{Sinput} \begin{Soutput} (Intercept) speed -17.579095 3.932409 \end{Soutput} \end{Schunk} \begin{Schunk} \begin{Sinput} > data(cars) > m1 <- lm( dist~speed, data=cars ) \end{Sinput} \end{Schunk} For some reason I cannot fathom, the first two chunks end up giving me *part* of the verbatim code twice (which is not what I was expecting), but the last two chunks do things as I expect. Can anyone point me to my error, or explain why this happens? P. > sessionInfo() R version 2.12.0 (2010-10-15) Platform: i386-apple-darwin9.8.0/i386 (32-bit) locale: [1] en_AU.UTF-8/en_AU.UTF-8/C/C/en_AU.UTF-8/en_AU.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] MASS_7.3-8 loaded via a namespace (and not attached): [1] tools_2.12.0 > version _ platform i386-apple-darwin9.8.0 arch i386 os darwin9.8.0 system i386, darwin9.8.0 status major 2 minor 12.0 year 2010 month 10 day 15 svn rev 53317 language R version.string R version 2.12.0 (2010-10-15) Peter Dunn: Biostatistician (Room T4.15) School of Health and Sport Science Faculty of Science, Health and Education ML-34 University of the Sunshine Coast, Locked Bag 4 Maroochydore DC Qld 4558 Tel: +61 7 5456 5085 Fax: +61 7 5430 2896 Email: pdu...@usc.edu.au www.usc.edu.au CRICOS Provider Number: 01595D This communication is intended for the recipient only and should not be forwarded, distributed or otherwise read by others without express permission. The views expressed in this email are not necessarily those of the University of the Sunshine Coast. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.