Dear list, I may have found a bug in model.frame.default (called by the lm function). The problem arises in my R dev version but not in my R 2.4.0. Here is my config : > version _ platform x86_64-unknown-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status Under development (unstable) major 2 minor 5.0 year 2007 month 03 day 04 svn rev 40813 language R version.string R version 2.5.0 Under development (unstable) (2007-03-04 r40813) Now a simple example to (hopefully) reproduce the bug (after a rm(list=ls())): > dat=data.frame(y=rnorm(10),x1=runif(10),x2=runif(10)) > weights=1:10/(sum(1:10)) > form <- as.formula("y~x1+x2") # here is the error > lm(form,data=dat,weights=weights) Erreur dans model.frame(formula, rownames, variables, varnames, extras, extranames, : type (closure) incorrect pour la variable '(weights)' (sorry, error message is in French) As I said, these commands works using R.2.4.0 (same machine, same OS). Moreover, the following commands work: > temp=weights > lm(form,data=dat,weights=temp) This currently seems to cause a check fail in the ade4 package. I tried to find out where the bug came from: all I found is the (potential) bug comes from model.frame.default, and more precisely: debug: data <- .Internal(model.frame(formula, rownames, variables, varnames, extras, extranames, subset, na.action)) Browse[1]> Erreur dans model.frame(formula, rownames, variables, varnames, extras, extranames, : type (closure) incorrect pour la variable '(weights)' I couldn't go further because of the .Internal. I tried to googlise this, but I found no such problem reported recently. Can anyone tell if this is actually a bug? (In case not, please tell me where I got wrong). Regards, Thibaut. -- ###################################### Thibaut JOMBART CNRS UMR 5558 - Laboratoire de Biom?trie et Biologie Evolutive Universite Lyon 1 43 bd du 11 novembre 1918 69622 Villeurbanne Cedex T?l. : 04.72.43.29.35 Fax : 04.72.43.13.88 jombart at biomserv.univ-lyon1.fr http://biomserv.univ-lyon1.fr/sitelabo/pageperso.php?id_personne=178
On 3/7/2007 9:47 AM, Thibaut Jombart wrote:> Dear list, > > I may have found a bug in model.frame.default (called by the lm function). > The problem arises in my R dev version but not in my R 2.4.0. > Here is my config :I don't see this bug in r40818 in Windows, and the log entry for r40817 looks like it may be relevant: fixing a buglet that crept in from the change to have $ warn when applied to an atomic vector This modified model.R and the NAMESPACE file of the stats package. Could you try a slightly newer build? Duncan Murdoch> > > version > > _ > platform > x86_64-unknown-linux-gnu > arch > x86_64 > os > linux-gnu > system x86_64, > linux-gnu > status Under development > (unstable) > major > 2 > minor > 5.0 > year > 2007 > month > 03 > day > 04 > svn rev > 40813 > language > R > version.string R version 2.5.0 Under development (unstable) (2007-03-04 > r40813) > > Now a simple example to (hopefully) reproduce the bug (after a > rm(list=ls())): > > > dat=data.frame(y=rnorm(10),x1=runif(10),x2=runif(10)) > > weights=1:10/(sum(1:10)) > > form <- as.formula("y~x1+x2") > # here is the error > > lm(form,data=dat,weights=weights) > Erreur dans model.frame(formula, rownames, variables, varnames, extras, > extranames, : > type (closure) incorrect pour la variable '(weights)' > > (sorry, error message is in French) > > As I said, these commands works using R.2.4.0 (same machine, same OS). > Moreover, the following commands work: > > temp=weights > > lm(form,data=dat,weights=temp) > > This currently seems to cause a check fail in the ade4 package. I tried > to find out where the bug came from: all I found is the (potential) bug > comes from model.frame.default, and more precisely: > debug: data <- .Internal(model.frame(formula, rownames, variables, > varnames, > extras, extranames, subset, na.action)) > Browse[1]> > Erreur dans model.frame(formula, rownames, variables, varnames, extras, > extranames, : > type (closure) incorrect pour la variable '(weights)' > > I couldn't go further because of the .Internal. I tried to googlise > this, but I found no such problem reported recently. > > Can anyone tell if this is actually a bug? (In case not, please tell me > where I got wrong). > > Regards, > > Thibaut. >
I don't see this bug (in r-devel r40818) but there are two changes between 40814 and 40818 that might have fixed it. -thomas On Wed, 7 Mar 2007, Thibaut Jombart wrote:> Dear list, > > I may have found a bug in model.frame.default (called by the lm function). > The problem arises in my R dev version but not in my R 2.4.0. > Here is my config : > > > version > > _ > platform > x86_64-unknown-linux-gnu > arch > x86_64 > os > linux-gnu > system x86_64, > linux-gnu > status Under development > (unstable) > major > 2 > minor > 5.0 > year > 2007 > month > 03 > day > 04 > svn rev > 40813 > language > R > version.string R version 2.5.0 Under development (unstable) (2007-03-04 > r40813) > > Now a simple example to (hopefully) reproduce the bug (after a > rm(list=ls())): > > > dat=data.frame(y=rnorm(10),x1=runif(10),x2=runif(10)) > > weights=1:10/(sum(1:10)) > > form <- as.formula("y~x1+x2") > # here is the error > > lm(form,data=dat,weights=weights) > Erreur dans model.frame(formula, rownames, variables, varnames, extras, > extranames, : > type (closure) incorrect pour la variable '(weights)' > > (sorry, error message is in French) > > As I said, these commands works using R.2.4.0 (same machine, same OS). > Moreover, the following commands work: > > temp=weights > > lm(form,data=dat,weights=temp) > > This currently seems to cause a check fail in the ade4 package. I tried > to find out where the bug came from: all I found is the (potential) bug > comes from model.frame.default, and more precisely: > debug: data <- .Internal(model.frame(formula, rownames, variables, > varnames, > extras, extranames, subset, na.action)) > Browse[1]> > Erreur dans model.frame(formula, rownames, variables, varnames, extras, > extranames, : > type (closure) incorrect pour la variable '(weights)' > > I couldn't go further because of the .Internal. I tried to googlise > this, but I found no such problem reported recently. > > Can anyone tell if this is actually a bug? (In case not, please tell me > where I got wrong). > > Regards, > > Thibaut. > > -- > ###################################### > Thibaut JOMBART > CNRS UMR 5558 - Laboratoire de Biom?trie et Biologie Evolutive > Universite Lyon 1 > 43 bd du 11 novembre 1918 > 69622 Villeurbanne Cedex > T?l. : 04.72.43.29.35 > Fax : 04.72.43.13.88 > jombart at biomserv.univ-lyon1.fr > http://biomserv.univ-lyon1.fr/sitelabo/pageperso.php?id_personne=178 > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >Thomas Lumley Assoc. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle
Please update to the latest snapshot R version 2.5.0 Under development (unstable) (2007-03-05 r40816) where all is well, Thibaut Jombart wrote:> Dear list, > > I may have found a bug in model.frame.default (called by the lm function). > The problem arises in my R dev version but not in my R 2.4.0. > Here is my config : > > > version > > _ > platform > x86_64-unknown-linux-gnu > arch > x86_64 > os > linux-gnu > system x86_64, > linux-gnu > status Under development > (unstable) > major > 2 > minor > 5.0 > year > 2007 > month > 03 > day > 04 > svn rev > 40813 > language > R > version.string R version 2.5.0 Under development (unstable) (2007-03-04 > r40813) > > Now a simple example to (hopefully) reproduce the bug (after a > rm(list=ls())): > > > dat=data.frame(y=rnorm(10),x1=runif(10),x2=runif(10)) > > weights=1:10/(sum(1:10)) > > form <- as.formula("y~x1+x2") > # here is the error > > lm(form,data=dat,weights=weights) > Erreur dans model.frame(formula, rownames, variables, varnames, extras, > extranames, : > type (closure) incorrect pour la variable '(weights)' > > (sorry, error message is in French) > > As I said, these commands works using R.2.4.0 (same machine, same OS). > Moreover, the following commands work: > > temp=weights > > lm(form,data=dat,weights=temp) > > This currently seems to cause a check fail in the ade4 package. I tried > to find out where the bug came from: all I found is the (potential) bug > comes from model.frame.default, and more precisely: > debug: data <- .Internal(model.frame(formula, rownames, variables, > varnames, > extras, extranames, subset, na.action)) > Browse[1]> > Erreur dans model.frame(formula, rownames, variables, varnames, extras, > extranames, : > type (closure) incorrect pour la variable '(weights)' > > I couldn't go further because of the .Internal. I tried to googlise > this, but I found no such problem reported recently. > > Can anyone tell if this is actually a bug? (In case not, please tell me > where I got wrong). > > Regards, > > Thibaut. >-- Robert Gentleman, PhD Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M2-B876 PO Box 19024 Seattle, Washington 98109-1024 206-667-7700 rgentlem at fhcrc.org