From p.dalgaard at biostat.ku.dk  Thu Dec 21 09:29:26 2006
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard)
Date: Thu, 21 Dec 2006 09:29:26 +0100
Subject: [Rd] R windows crash (PR#9426)
In-Reply-To: <20061220235740.D29D029D3C@slim.kubism.ku.dk>
References: <20061220235740.D29D029D3C@slim.kubism.ku.dk>
Message-ID: <458A45E6.3050202@biostat.ku.dk>

robert.denham at nrm.qld.gov.au wrote:
> Full_Name: Robert Denham
> Version: R-2.4.1
> OS: Windows Xp
> Submission from: (NULL) (61.88.57.1)
>
>
> R gui exits without warning when I run a function which has an argument with a
> default that is not found.  
>
> This was a result of an error in a function I wrote, but I thought that it
> should exit more gracefully than it does. Here is an example:
>
>
> testfun <- function(aa=aa) {
>     aa <- lm(y~x,data=aa)
>     return(aa)
> }
>
> testfun() #R then exits.
>
> Note that 
>
> testfun <- function(aa=bb) {
>     aa <- lm(y~x,data=aa)
>     return(aa)
> }
>
> works as it should, giving "object bb not found".
>
>   
This seems reproducible on  Linux, except that it goes into an infinite 
loop. The lm call seems to be the real culprit:

 > testfun <- function(aa=aa) return(aa)
 > testfun()
Error in testfun() : recursive default argument reference
 > testfun <- function(aa=aa) lm(x~y,data=aa)
 > testfun()
(*poof*)


> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



[Rd] R windows crash (PR#9426)
Peter Dalgaard