Dear Martin,

Since no one else has picked up on this, I’ll take a crack at it: 

The proposal is to define the S3 class of model-frame objects as 
c(“model.frame”, “data.frame”) (not the formal class of these objects, even 
though this feature was coincidentally introduced in S4). That’s unlikely to do 
harm, since model frames would still “inherit” data.frame methods. 

It's possible that some packages rely on current data.frame methods that are 
eventually superseded by specific model.frame methods or do something peculiar 
with the class of model frames, so as far as I can see, one can’t know whether 
problems will arise before trying it.

I hope that helps,
 John

  -------------------------------------------------
  John Fox, Professor Emeritus
  McMaster University
  Hamilton, Ontario, Canada
  Web: http::/socserv.mcmaster.ca/jfox

> On Dec 21, 2018, at 2:51 AM, Martin Maechler <maech...@stat.math.ethz.ch> 
> wrote:
> 
>>>>>> William Dunlap via R-devel 
>>>>>>    on Thu, 20 Dec 2018 15:09:56 -0800 writes:
> 
>> 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?
> 
> May guess is "oversight" || "well let's keep it simple"
> Do you (all readers) see situation where it could harm now (with
> the 20'000 packages on CRAN+BIoc+...) to do as SV4 (S version 4) has been 
> doing?
> 
> I'd be sympathetic to class()ing it.
> Martin
> 
>> Bill Dunlap TIBCO Software wdunlap tibco.com
> 
> ______________________________________________
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to