[Rd] possible bug in model.frame.default

Duncan Murdoch murdoch at stats.uwo.ca
Wed Mar 7 16:16:53 CET 2007


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.
>



More information about the R-devel mailing list