From m@echler @ending from @t@t@m@th@ethz@ch  Sat Sep 29 15:40:21 2018
From: m@echler @ending from @t@t@m@th@ethz@ch (Martin Maechler)
Date: Sat, 29 Sep 2018 15:40:21 +0200
Subject: [Rd] Improvement to documentation in dput.Rd
In-Reply-To: <3e8ce8c001334129991999e5f68aa332@C119S212VM016.msvyvi.vaha.local>
References: <3e8ce8c001334129991999e5f68aa332@C119S212VM016.msvyvi.vaha.local>
Message-ID: <23471.32965.252988.444727@stat.math.ethz.ch>

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

Martin



[Rd] Improvement to documentation in dput.Rd
Martin Maechler