[Rd] possible bug in model.frame.default

Thibaut Jombart jombart at biomserv.univ-lyon1.fr
Wed Mar 7 15:47:13 CET 2007


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



More information about the R-devel mailing list