ripley@stats.ox.ac.uk
2004-Apr-29 12:12 UTC
[Rd] Re: model.matrix(x ~ y) bug when y is array (PR#6838)
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@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