[Rd] formula(CO2)
Gabor Grothendieck
ggrothendieck at gmail.com
Mon Jul 16 16:16:10 CEST 2007
Following up on your comments it seems formula.data.frame just creates
a formula whose lhs is the first column name and whose rhs is made up
of the remaining column names. It ignores the "formula" attribute.
In fact, CO2 does have a formula attribute but its not extracted by
formula.data.frame:
> CO2 at formula
uptake ~ conc | Plant
> formula(CO2)
Plant ~ Type + Treatment + conc + uptake
Is this really how its supposed to work???
On 7/16/07, Ted Harding <ted.harding at nessie.mcc.ac.uk> wrote:
> On 16-Jul-07 13:28:50, Gabor Grothendieck wrote:
> > The formula attribute of the builtin CO2 dataset seems a bit strange:
> >
> >> formula(CO2)
> > Plant ~ Type + Treatment + conc + uptake
> >
> > What is one supposed to do with that? Certainly its not suitable
> > for input to lm and none of the examples in ?CO2 use the above.
>
> I think one is supposed to ignore it! (Or maybe be inspired to
> write a mail to the list ... ).
>
> I couldn't find anything that looked like the above formula from
> str(CO2). But I did spot that the order of terms in the formula:
> Plant, Type, treatment, conc, uptake, is the same as the order
> of the "columns" in the dataframe.
>
> So I tried:
>
> D<-data.frame(x=(1:10),y=(1:10))
>
> formula(D)
> x ~ y
>
> So, lo and behold, D has a formula!
>
> Or does it? Maybe if you give formula() a dataframe, it simply
> constructs one from the "columns".
>
> Best wishes,
> Ted.
>
> --------------------------------------------------------------------
> E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
> Fax-to-email: +44 (0)870 094 0861
> Date: 16-Jul-07 Time: 14:57:28
> ------------------------------ XFMail ------------------------------
>
More information about the R-devel
mailing list