From ggrothendieck at gmail.com  Mon May  9 15:18:46 2005
From: ggrothendieck at gmail.com (Gabor Grothendieck)
Date: Mon May  9 15:19:31 2005
Subject: [Rd] Variable names with spaces in lm
Message-ID: <971536df050509061840ba9f7e@mail.gmail.com>

'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".


[Rd] Variable names with spaces in lm
Gabor Grothendieck