[Rd] Putting an object in a data farme

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Jun 24 18:50:08 MEST 2003

On Tue, 24 Jun 2003, Duncan Murdoch wrote:

> I'd like to use the modelling functions, in particular  model.frame,
> with the S4 orientation objects I'm writing.  

That's probably not a good idea: I gave up for S-PLUS with S4 classes a 
long time back.  Too many utilities assumed that a classed object was a 
list with components like call and formula.

> However, these use
> data.frames, and data.frames object to having my objects put in them.
> model.frame checks the mode of the object before it puts it in;
> data.frame seems to be trying to coerce my class to data.frame, and
> it's failing.
> What's necessary to put a nonstandard object into a data.frame?

You need either to enclose it in I() or write an as.data.frame method for 
it, which may be difficult if it does not have an S3 class.


Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-devel mailing list