[R] Sweave : some comments disappear

Remko Duursma remkoduursma at gmail.com
Tue Sep 6 11:04:47 CEST 2011


Sorry about that - I did give an example that I thought was
reproducible (it is here), but apparently wasn't.

I suspect my problem might have to do with the 'highlight' package I
am using - which I should have mentioned.

I am using the latest version of R.

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



On Tue, Sep 6, 2011 at 6:55 PM, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> On Tue, 6 Sep 2011, Achim Zeileis wrote:
>
>> 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
>
> I suspected he used an obsolete version of R, where such things happened.
>  Which is why we ask in the posting guide to update before posting, give 'at
> a minimum' information and a reproducible example.
>
>>
>>>
>>> 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.
>>
>
> --
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>



More information about the R-help mailing list