On May 31, 2009, at 12:22 AM, Duncan Murdoch wrote:

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


Actually, I think it hid the options() function.

Since I was doing this at the RGui and became concerned that it appeared I no longer had any options, I restarted. Could I have saved time by just executing rm(options)?


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.

Because it might be executed before the loading of the default packages?

--
David
 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



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