From: Sebastian.Wastl.Meyer@campus.lmu.de Full_Name: Sebastian Meyer Version: 2.10.0 OS: x86_64-pc-linux-gnu Submission from: (NULL) (77.135.124.96) When using model.frame (model.frame.default) on an intercept-only model and with na.action=na.fail SPECIFIED, i.e. data(iris) model.frame( ~ 1, data = iris, na.action = na.fail) one gets the following error: Error in complete.cases(object) : negative length vectors are not allowed There is no error if the na.action argument is left UNSPECIFIED (though the default value also is na.fail!): model.frame( ~ 1, data = iris) In either case, there should be no error. Specifing other na.action functions (na.omit, na.pass, na.exclude) works. If there is at least one (non-intercept) variable in the formula, e.g. model.frame( ~ 1 + Species, data = iris, na.action = na.fail) there is obviously no issue. Best regards, Sebastian Meyer
NOTES: error is in complete.cases, fixed in 2.10.0 patched
Audit (from Jitterbug): Sun Nov 15 18:29:09 2009 ripley changed notes Sun Nov 15 18:29:09 2009 ripley moved from incoming to Analyses-fixed
From: Prof Brian Ripley <ripley@stats.ox.ac.uk> Thank you for the report -- but a bit more investigation of the root cause would have been even more helpful: this is not 'model.frame error', nor even reported by R as such. The issue was that complete.cases() did not know how to find the number of rows of a 0-column data frame (it knew nothing about data frames). That has been changed in R-patched and R-devel, together with a more informative error message in other cases where the number of rows is unspecified. On Sun, 15 Nov 2009, Sebastian.Wastl.Meyer@campus.lmu.de wrote: > Full_Name: Sebastian Meyer > Version: 2.10.0 > OS: x86_64-pc-linux-gnu > Submission from: (NULL) (77.135.124.96) > > > When using model.frame (model.frame.default) on an intercept-only model and with > na.action=na.fail SPECIFIED, i.e. > > data(iris) That line is unnecessary: 'iris' is a visible object in package 'datasets'. > model.frame( ~ 1, data = iris, na.action = na.fail) > > one gets the following error: > > Error in complete.cases(object) : negative length vectors are not allowed > > There is no error if the na.action argument is left UNSPECIFIED (though the > default value also is na.fail!): > > model.frame( ~ 1, data = iris) > > In either case, there should be no error. Specifing other na.action functions > (na.omit, na.pass, na.exclude) works. > If there is at least one (non-intercept) variable in the formula, e.g. > > model.frame( ~ 1 + Species, data = iris, na.action = na.fail) > > there is obviously no issue. > > Best regards, > Sebastian Meyer > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > -- 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
From: Sebastian Meyer <Sebastian.Wastl.Meyer@campus.lmu.de> Thank you for your rapid bug fix and for your instructive comments on my bug report. > this is not 'model.frame error', nor even reported by R as such. Of course you are right, but I thought that a bug report on model.frame would probably reach more attention further providing a more motivating frame for the bug than just writing that complete.cases(as.data.frame(matrix(,150,0))) would not work, and I was absolutely sure that you would be able to track down the source of the problem. >> data(iris) > > That line is unnecessary: 'iris' is a visible object in package > 'datasets'. Ok. I was not sure about this and just wanted to be on the save side to offer a reproducible example working in a maximum variety of R sessions. Best regards and thank you very much for your intense development of R, Sebastian Meyer