[R] 'options=utils::recover' not working in .Rprofile or within R

David Winsemius dwinsemius at comcast.net
Sun May 31 04:49:54 CEST 2009


You are wiping out all of the default options with that approach.

Try (after restarting R to get the other options back to what they  
should be):

op=options()                   # so you can reset back to baseline
options(error=utils::recover)  # do not think the "utils::" is needed
  my.func <- function(x){
   y <- x + 12
   nonsense
   y
   }

  my.func(14)
Error in my.func(14) : object "nonsense" not found

Enter a frame number, or 0 to exit

1: my.func(14)

Selection:



On May 30, 2009, at 10:24 PM, Mark Kimpel wrote:

> Duncan,
>
> I've pared down my .Rprofile so that it has just the options line,  
> started R
> from terminal (instead of using ESS-emacs) and I still have the  
> problem. Am
> I specifying the options incorrectly? I believe I took this directly  
> from
> the help page.

Not what the examples look like on my machine.

> See my output of .Rprofile, the code example that doesn't
> work as we think it ought, and my sessionInfo().  Thanks, Mark
>
> Type 'demo()' for some demos, 'help()' for on-line help, or
> 'help.start()' for an HTML browser interface to help.
> Type 'q()' to quit R.
>
>> read.table("~/.Rprofile")
>                      V1
> 1 options=utils::recover
>> my.func <- function(x){
> + y <- x + 12
> + nonsense
> + y
> + }
>> my.func(14)
> Error in my.func(14) : object 'nonsense' not found
>> sessionInfo()
> R version 2.9.0 (2009-04-17)
> x86_64-unknown-linux-gnu
>
> locale:
> LC_CTYPE 
> = 
> en_US 
> .UTF 
> -8 
> ;LC_NUMERIC 
> = 
> C 
> ;LC_TIME 
> = 
> en_US 
> .UTF 
> -8 
> ;LC_COLLATE 
> = 
> en_US 
> .UTF 
> -8 
> ;LC_MONETARY 
> = 
> C 
> ;LC_MESSAGES 
> = 
> en_US 
> .UTF 
> -8 
> ;LC_PAPER 
> = 
> en_US 
> .UTF 
> -8 
> ;LC_NAME 
> = 
> C 
> ;LC_ADDRESS 
> =C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list