I suppose that this never affects anything, but in line 57 of lm.R, where the coefficients are defined for an empty model, when y is a matrix, shouldn't the value be matrix(,0,nrow(y)) rather than matrix(,0,3)?