From wdunl@p @ending from tibco@com  Fri Dec 21 00:09:56 2018
From: wdunl@p @ending from tibco@com (William Dunlap)
Date: Thu, 20 Dec 2018 15:09:56 -0800
Subject: [Rd] formula(model.frame(..)) is misleading
Message-ID: <CAF8bMcaSrPfpdJMOeDg0ptJBLJrZvOJiEy7Bdkf3-oZZwNYnuw@mail.gmail.com>

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?

Bill Dunlap
TIBCO Software
wdunlap tibco.com

	[[alternative HTML version deleted]]



[Rd] formula(model.frame(..)) is misleading
William Dunlap