There is one other problem with the coercion to data.frame. terms.formula does not actually use the data contents, I think, so if it did not coerce to a data frame it could handle unequal length data in lists too.
On 09 May 2005 19:37:25 +0200, Peter Dalgaard <[EMAIL PROTECTED]> wrote: > Gabor Grothendieck <[EMAIL PROTECTED]> writes: > > > 'lm' gives an error when using variables with spaces in them > > in certain cases (but not all): > > > > my.list <- list(`a 1` = 1:4, `a 2` = 11:14) > > lm(`a 1` ~ ., my.list) # Error : Object "a.1" not found > > > > # The following work ok so it does work in many cases: > > > > lm(`a 1` ~ ., as.data.frame(my.list, optional = TRUE)) # ok > > lm(`a 1` ~ `a 2`, my.list) # ok > > > > Admittedly ?lm says that the data argument should be > > a data frame or environment so this is not strictly a bug > > but it seems to work with a list and the code even seems to > > coerce it to a data frame. > > > > I am using Windows XP "R version 2.1.0, 2005-04-18". > > As you probably gathered, the issue is that there's an as.data.frame() > without optional=TRUE sitting inside terms.formula which causes the > "." to expand to a.1 + a.2. Sounds like that's unconditionally a bug, > but I'm a little unsure... > > -- > O__ ---- Peter Dalgaard Blegdamsvej 3 > c/ /'_ --- Dept. of Biostatistics 2200 Cph. N > (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 > ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 > ______________________________________________ R-devel@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-devel