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

Prof Brian D Ripley ripley at stats.ox.ac.uk
Wed Aug 27 10:49:34 MEST 2003


Terms in formulae which are not syntactic names are not supported in R at
present, and nothing that I know of says they are.  We are working towards
that as a goal, but this is not a bug.


On Wed, 27 Aug 2003 Andrea.Capodicasa at albacom.it wrote:

> 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"
>
> ______________________________________________
> R-devel at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
>
>

-- 
Brian D. Ripley,                  ripley at 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



More information about the R-devel mailing list