From tlumley at u.washington.edu  Wed Mar  7 16:57:19 2007
From: tlumley at u.washington.edu (Thomas Lumley)
Date: Wed, 7 Mar 2007 07:57:19 -0800 (PST)
Subject: [Rd] possible bug in model.frame.default
In-Reply-To: <45EED071.6070609@biomserv.univ-lyon1.fr>
References: <45EED071.6070609@biomserv.univ-lyon1.fr>
Message-ID: <Pine.LNX.4.64.0703070755130.27471@homer23.u.washington.edu>


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


[Rd] possible bug in model.frame.default
Thomas Lumley