[Rd] Is formula(data.frame) documented?

From: Kevin Wright <kw.statr_at_gmail.com>
Date: Fri, 18 May 2007 09:45:07 -0500


The Examples section of 'unstack' includes:

formula(PlantGrowth) # check the default formula

I wanted to add a formula to my own data.frame (for unstacking), so I start looking:
?formula # Nothing here about adding a formula to data
attr(PlantGrowth, "formula") # Nothing here--c.f. groupedData objects dput(PlantGrowth) # Hmm, no formula here either
?formula.data.frame # Aliased to formula. Growing more frustrated.

After more experimentation, I guessed that 'formula.data.frame' is using the first column as the response and other columns as model terms. Eventually I had the idea to look in S-Plus:

?formula.data.frame

This is a method for the function formula() for objects inheriting from class data.frame. If object is a model frame, the formula for the model frame is returned, otherwise a formula is deduced from the names of object. The first name is taken to be the response, and all the remaining names are pasted together additively.

Ah. Simple, lucid.

Two notes:

  1. Would it be possible to add documentation for formula.data.frame? (I can create a .Rd file--just ask).
  2. General comment to the R community: As a user, I sometimes find that it would be much clearer to have separate help files with links in the 'See Also' section rather than using 'aliased' help for multiple functions in a single file. (I readily admit that separate help files are more work...)

Thanks,

K Wright



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri 18 May 2007 - 14:54:00 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 18 May 2007 - 15:03:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.