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

maechler at stat.math.ethz.ch maechler at stat.math.ethz.ch
Wed Apr 28 16:45:04 CEST 2004


A spill over from R-help  reports by
Jonathan Williams, Rich Raubertas, Göran Broström et al. :

x  <- 1:7
y. <- x 
y  <- array(x)

model.matrix(x ~ y) # behaves badly when called repeatedly;
	       	    # which for me means memory allocation problems
## as opposed to 

 model.matrix(x ~ y.) # which is all fine

The bug is in model.matrix.default():
one part of the problems happens in the line
    ans <- .Internal(model.matrix(t, data))
    (which only returns the intercept part).

How to fix this is not yet clear to me, since we have to decide
if the internal C code should do more checking
or the R code in model.matrix.default.

Martin



More information about the R-devel mailing list