[R] Environment problems

Uwe Ligges ligges at statistik.uni-dortmund.de
Tue May 23 09:08:21 CEST 2006


Hans Gardfjell wrote:

> Dear list readers,
> 
> Can someone of you explain this behavior. Here's a toy example:
> 
> Start by constructing a function tmp
> 
>  >fix(tmp)
> 
> In the default editor enter this one-liner:
> hist(rnorm(10))
> 
> close the editor and run environment on the function.
> 
>  > environment(tmp)
> <environment: R_GlobalEnv>
> 
> Open the editor and remove the last parenthesis, this will make the 
> editor choke.
> 
>  > fix(tmp)
> Error in edit(name, file, title, editor) :
>         an error occurred on line 4
>  use a command like
>  x <- edit()
>  to recover
> 
> Put the paranthesis back:
> 
>  > edit()->tmp
> 
>  > environment(tmp)
> <environment: base>
>  > tmp()
> Error in tmp() : could not find function "hist"
> 
> And as you can see, the function doesn't work anymore...
> Yes, I know I can manually change the environment back to .GlobalEnv, 
> but is this the way it supposed to work?

No, but it has already been fixed. Please try the beta version of R-2.3.1.

Uwe Ligges



> This example is done in
> 
>  > R.Version()$version.string
> [1] "Version 2.3.0 Patched (2006-04-25 r37924)"
> 
> on WindowsXP
> 
> Cheers, Hans
>



More information about the R-help mailing list