[Rd] y ~ X -1 , X a matrix

Ross Boylan ross at biostat.ucsf.edu
Thu Mar 18 02:24:25 CET 2010


On Thu, 2010-03-18 at 00:57 +0000, Ted.Harding at manchester.ac.uk wrote:
> On 17-Mar-10 23:32:41, Ross Boylan wrote:
> > While browsing some code I discovered a call to lm that used
> > a formula y ~ X - 1, where X was a matrix.
> > 
> > Looking through the documentation of formula, lm, model.matrix
> > and maybe some others I couldn't find this useage (R 2.10.1).
> > Is it anything I can count on in future versions?  Is there
> > documentation I've overlooked?
> > 
> > For the curious: model.frame on the above equation returns a
> > data.frame with 2 columns.  The second "column" is the whole X
> > matrix. model.matrix on that object returns the expected matrix,
> > with the transition from the odd model.frame to the regular
> > matrix happening in an .Internal call.
> > 
> > Thanks.
> > Ross
> > 
> > P.S. I would appreciate cc's, since mail problems are preventing
> > me from seeing list mail.
> 
> Hmmm ... I'm not sure what is the problem with what you describe.
There is no problem in the "it doesn't work" sense.
There is a problem that it seems undocumented--though the help you quote
could rather indirectly be taken as a clue--and thus, possibly, subject
to change in later releases.

Ross Boylan



More information about the R-devel mailing list