[R] Comments disappearing from local functions (R 2.14.0)

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Nov 24 21:59:41 CET 2011


On Fri, 25 Nov 2011, Patrick Connolly wrote:

> On Mon, 21-Nov-2011 at 09:46PM +1300, Rolf Turner wrote:
>
> [....]

Please don't excise content, nor mix up topics.  I am going to reply 
here just to the subject line, and reply to your use of pdf() under 
multicore separately.

>
> |> It *doesn't* happen to me.  Ergo it would appear to be peculiar
> |> to your particular set-up.
> |>
> |> What does options()$keep.source say?  (Mine says "TRUE".)
> |>
>
> Same here in both cases.

[...]

> My main question is: Can I redo the updating of the packages with
> checkBuilt to downgrade them back to the previous version?  Something
> is not right with either of my installations and I'd like to revert.
>
> The problem with the disappearing comments occurs when I wish to
> attach to another directory.  I commonly reuse functions from previous
> years and modify them for the current year.
>
> If my pwd is, say ~/thisYear, I'll do something like
> attach("~/lastYear/.RData")
>
> If I then edit the function of interest, when it's saved I have the
> appropriate version in ~/thisYear/.RData which I find a convenient way
> to work.  If the comments aren't there, it's far less usable.  If I
> can go back to R-2.13.1 I can still work that way.

So you missed the NEWS item:

     • The "source" attribute on functions created with keep.source=TRUE
       has been replaced with a "srcref" attribute.  The "srcref"
       attribute references an in-memory copy of the source file using
       the "srcfilecopy" class or the new "srcfilealias" class.

This means that if you save a function under R 2.13.1 and load/attach 
it under R 2.14.0, its kept source (with the comments) is no longer 
available.

However your original posting did not mention save/attach, nor that 
you saved under one version and attached under another.  That is hte 
only circumstance under which I can make it do what you claim.

And now you know not to do that.  Dump your functions in 2.13.1, and 
source/save in 2.14.0.


-- 
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