David Winsemius wrote:
You are wiping out all of the default options with that approach.

Actually, I think it hid the options() function.
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

Not if you run it in the console, but it is needed in .Rprofile. Saving the old option could be done as

olderror <- options(error=utils::recover)

Duncan Murdoch
  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


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to