[Rd] Re: model.matrix(x ~ y) bug when y is array (PR#6838)

ripley at stats.ox.ac.uk ripley at stats.ox.ac.uk
Thu Apr 29 12:12:45 CEST 2004


The underlying cause is that ncols(1D array) returns a random result,
often zero, so the term gets zero columns allocated in the model matrix
and a (long-existent) loop assums that columns is strictly positive.

I am putting in a check for zero columns, as well as repairing ncols which 
does

      t = getAttrib(s, R_DimSymbol);
      if (t == R_NilValue) return 1;
      return INTEGER(t)[1];

without any check on the length of t!

On Wed, 28 Apr 2004, Prof Brian Ripley wrote:

> I will tomorrow.  I want to know why it is happening before we guard 
> against whatever is the problem.
> 
> On Wed, 28 Apr 2004, Martin Maechler wrote:
> 
> > Is anybody actively looking into this?
> > 
> > If yes, I won't.
> > 
> > There are many places one could guard against the problem,
> > terms() being another possibility besides model.matrix.default()
> > or model.frame() or ...


-- 
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