[Rd] Problem in step() and stepAIC() when a name of a regressors has b (PR#3991)

Andrea.Capodicasa at albacom.it Andrea.Capodicasa at albacom.it
Wed Aug 27 11:39:29 MEST 2003


Hi all,
I've experienced this problem using step() and stepAIC() when a name of a
regressors has blanks in between (R:R1.7.0, os: w2ksp4).

Please look at the following code:

		"x" <-
		c(14.122739306734, 14.4831100207131, 14.5556459667089,
14.5777151911177, 
		14.5285815352327, 14.0217803203846, 14.0732571632964,
14.7801310180502, 
		14.7839362960477, 14.7862217992577)

		"reg" <-
		structure(list(feriale = c(0, 1, 1, 1, 1, 0, 0, 1, 1, 1),
pasquetta = c(0, 
		0, 0, 0, 0, 0, 0, 0, 0, 0), giorno = structure(c(2, 3, 4, 5,

		6, 7, 1, 2, 3, 4), class = "factor", .Label = c("1-DOM",
"2-LUN", 
		"3-MAR", "4-MER", "5-GIO", "6-VEN", "7-SAB"))), .Names =
c("feriale", 
		"pasquetta", "giorno"), row.names = c("1", "2", "3", "4",
"5", 
		"6", "7", "8", "9", "10"), class = "data.frame")

		#this works
		lm(x~., data=reg)

		#this works
		step(lm(x~., data=reg))

		#this works
		library(MASS)
		stepAIC(lm(x~., data=reg))

		#when you change a name of a regressors inserting blanks
step and stepAIC won't work
		names(reg)[1]="with blank"
		names(reg)

		#this still works
		lm(x~., data=reg)

		#this doesn't work
		step(lm(x~., data=reg))

#this is the error
#"Error in parse(file, n, text, prompt) : parse error"


		#this doesn't work
		stepAIC(lm(x~., data=reg))

# the error is the same as step
#"Error in parse(file, n, text, prompt) : parse error"


These are my R.version() and Sys.info() relevant infos.
> R.Version()
$platform
[1] "i386-pc-mingw32"

$arch
[1] "i386"

$os
[1] "mingw32"

$system
[1] "i386, mingw32"

$status
[1] ""

$major
[1] "1"

$minor
[1] "7.0"

$year
[1] "2003"

$month
[1] "04"

$day
[1] "16"

$language
[1] "R"

> Sys.info()
                      sysname                       release
version                       
                    "Windows"                      "NT 5.0" "(build 2195)
Service Pack 4"            
                      machine            
                        "x86"



More information about the R-devel mailing list