From murdoch at stats.uwo.ca  Thu Oct 12 19:54:09 2006
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Thu, 12 Oct 2006 13:54:09 -0400
Subject: [Rd] data.frame within a function (PR#9294)
In-Reply-To: <20061012174524.9270B4C916@slim.kubism.ku.dk>
References: <20061012174524.9270B4C916@slim.kubism.ku.dk>
Message-ID: <452E8141.5010400@stats.uwo.ca>

On 10/12/2006 1:45 PM, rcheng at purdue.edu wrote:
> Full_Name: Riyan Cheng
> Version: windows 2.0.1

This version is really quite ancient.  The current release is 2.4.0.

> OS: windows xp
> Submission from: (NULL) (74.140.105.186)
> 
> 
> 
> If one runs the following function ff(), an error would occur regarding
> data.frame():
>   ff<- function(){
>      x<- rnorm(10)
>      y<- rnorm(10)
>      lm1<- lm(y~1,data=data.frame(y=y,x=x)); cat("ok\n")
>      update(lm1,~ .+x,evaluate=T); cat("also ok\n")
>      add1(lm1, ~ .+x);  cat("again ok\n")
>   }
>   ff()
> But if there are external variables y and x, one would not get correct results.

If the problem still exists, then please say what the results are that 
you get, and why you think they are not correct.

Duncan Murdoch

> This problem does not exist if one directly runs the body of the function:
>   x<- rnorm(10)
>   y<- rnorm(10)
>   lm1<- lm(y~1,data=data.frame(y=y,x=x)); cat("ok\n")
>   update(lm1,~ .+x,evaluate=T); cat("also ok\n")
>   add1(lm1, ~ .+x);  cat("again ok\n")
> 
> There is exactly the same problem in Unix version.
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel




[Rd] data.frame within a function (PR#9294)
Duncan Murdoch