[R] Sweave : some comments disappear

Achim Zeileis Achim.Zeileis at uibk.ac.at
Tue Sep 6 10:20:45 CEST 2011


On Tue, 6 Sep 2011, Remko Duursma wrote:

> Dear R-helpers,
>
>
> when I have an R code chunk in a sweave file like this:
>
> <<>>=
> x <- 1:10
>
> # this comment disapears
> x
>
> # this one does not!
> print(x)
>
> #mean
> mean(x)
> @
>
> The first comment does not appear in the sweaved document, the second
> one does. How can this be?
>
> I have tried print=TRUE and  keep.source=TRUE, but neither seem to
> affect this behavior.

I cannot replicate this. I included this in a simple document with

\documentclass[a4paper]{article}
\begin{document}
<<>>=
...
@
\end{document}

When I use the version above, _no_ comment shows up (as expected). When I 
use <<keep.source=TRUE>>= then _all_ comments show up (as expected).

This is R 2.13.1 on Debian/GNU Linux.
Z

>
> thanks,
> Remko
>
>
>
>
>
> -------------------------------------------------
> Remko Duursma
> Research Lecturer
>
> Hawkesbury Institute for the Environment
> University of Western Sydney
> Hawkesbury Campus, Richmond
>
> Mobile: +61 (0)422 096908
> www.remkoduursma.com
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list