From wdunlap at tibco.com  Fri Jan  7 02:29:42 2011
From: wdunlap at tibco.com (William Dunlap)
Date: Thu, 6 Jan 2011 17:29:42 -0800
Subject: [Rd] formula(model.frame(y~.^2,
	data=d)) does not return formula from terms attribute of the
	model.frame
Message-ID: <77EB52C6DD32BA4D87471DCD70C8D70003C2E52B@NA-PA-VBE03.na.tibco.com>

In R 2.12.0 I get
  > d <- data.frame(x=1:10, y=log(1:10), f3=LETTERS[rep(1:3,c(3,3,4))])
  > m <- model.frame(y~.^2, data=d)
  > formula(m)
  y ~ x + f3
In S+ formula(m) gives formula given to model.frame(),
but in R you have to do the following get that formula:
  > formula(attr(m, "terms"))
  y ~ (x + f3)^2

Would it break anything to add to the top of formula.data.frame
something like
  if (!is.null(tms <- attr(x, "terms"))) {
    return(formula(tms))
  }
so that formula() would retrieve the formula buried
in model.frame's output?

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 



[Rd] formula(model.frame(y~.^2, data=d)) does not return formula from terms attribute of the model.frame
William Dunlap