From m@echler @ending from @t@t@m@th@ethz@ch  Fri Dec 21 08:51:06 2018
From: m@echler @ending from @t@t@m@th@ethz@ch (Martin Maechler)
Date: Fri, 21 Dec 2018 08:51:06 +0100
Subject: [Rd] formula(model.frame(..)) is misleading
In-Reply-To: <CAF8bMcaSrPfpdJMOeDg0ptJBLJrZvOJiEy7Bdkf3-oZZwNYnuw@mail.gmail.com>
References: <CAF8bMcaSrPfpdJMOeDg0ptJBLJrZvOJiEy7Bdkf3-oZZwNYnuw@mail.gmail.com>
Message-ID: <23580.39786.529658.257284@stat.math.ethz.ch>

>>>>> William Dunlap via R-devel 
>>>>>     on Thu, 20 Dec 2018 15:09:56 -0800 writes:

    > When formula() is applied to the output of model.frame()
    > it ignores the formula in the model.frame's 'terms'
    > attribute:

    >> d <- data.frame(A=log(1:6), B=LETTERS[rep(1:2,c(2,4))],
    >> C=1/(1:6),
    > D=rep(letters[25:26],c(4,2)), Y=1:6)
    >> m0 <- model.frame(data=d, Y ~ A:B) formula(m0)
    >   Y ~ A + B
    >> `attributes<-`(terms(m0), value=NULL)
    >   Y ~ A:B

    > This is in part because model.frame()'s output has class
    > "data.frame" instread of c("model.frame","data.frame"), as
    > SV4 did, so there are no methods for model.frames.

    > Is there a reason that model.frame() returns a data.frame
    > with extra attributes but no special class or is it just
    > an oversight?

May guess is "oversight" || "well let's keep it simple"
Do you (all readers) see situation where it could harm now (with
the 20'000 packages on CRAN+BIoc+...) to do as SV4 (S version 4) has been doing?

I'd be sympathetic to class()ing it.
Martin

    > Bill Dunlap TIBCO Software wdunlap tibco.com



[Rd] formula(model.frame(..)) is misleading
Martin Maechler