[Rd] Improvement to documentation in dput.Rd

Martin Maechler m@echler @ending from @t@t@m@th@ethz@ch
Sat Sep 29 15:40:21 CEST 2018

>>>>> Korpela Mikko (MML) 
>>>>>     on Sat, 29 Sep 2018 06:49:25 +0000 writes:

    > If the "Matrix" package is attached, 'example(dget)'
    > fails:
    >> library(Matrix) example(dget)
    dget> fil <- tempfile()
    dget> ## Write an ASCII version of function mean to our temp
    dget> file dput(mean, fil)

    dget> ## And read it back into 'bar' bar <- dget(fil)
    >   Error in initialize(value, ...) : '...' used in an
    > incorrect context

    > A possible fix would be to use 'dput(base::mean, fil)'
    > instead of 'dput(mean, fil)' in
    > src/library/base/man/dput.Rd .

    > -- 
    > Mikko Korpela

Thank you, Mikko,
indeed that's an improvement which I have done now (svn 75380).


In an ideal world the deparse()'ing  [equivalent: dput()] of S4
generics and methods would give an expression which is not only
parse()able -- which it is finely here -- but would also be
correct when eval()'ed subsequently.

So in this sense, one could also for a "bug" fix which would provide that.
OTOH we do say in the docs that parse() typically works as
inverse of deparse()  {and hence dget() as inverse of dput()}
but not always...


More information about the R-devel mailing list