Mark Kimpel
2009-May-30 03:45 UTC
[R] 'options=utils::recover' not working in .Rprofile or within R
For years I have been using options(error = recover) either in .Rprofile or
from within R for debugging purposes. The functionality of this appears to
have changed and I can't recover it (no pun intended) using the ?options
help page. How can I get the old functionality back, particularly from
within .Rprofile? A specific line entry would be appreciated. An example,
the help page, and sessionInfo() follow. Thanks, Mark
b.func <- function(x) {y <- x + 2; nonsense; y}> b.func(3)
Error in b.func(3) : object 'nonsense' not found ## in the past this
would
be a menu with numbers for what level I want to go to (in this case just 1)
This help page states:
'error': either a function or an expression governing the handling
of non-catastrophic errors such as those generated by 'stop'
as well as by signals and internally detected errors... The
functions 'dump.frames' and 'recover' provide
alternatives
that allow post-mortem debugging. Note that these need to
specified as e.g. 'options=utils::recover' in startup files
such as '.Rprofile'.
> 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 datasets utils methods base
------------------------------------------------------------
Mark W. Kimpel MD ** Neuroinformatics ** Dept. of Psychiatry
Indiana University School of Medicine
15032 Hunter Court, Westfield, IN 46074
(317) 490-5129 Work, & Mobile & VoiceMail
(317) 399-1219 Home
Skype: mkimpel
"The real problem is not whether machines think but whether men do."
-- B.
F. Skinner
******************************************************************
[[alternative HTML version deleted]]
Duncan Murdoch
2009-May-30 09:41 UTC
[R] 'options=utils::recover' not working in .Rprofile or within R
On 29/05/2009 11:45 PM, Mark Kimpel wrote:> For years I have been using options(error = recover) either in .Rprofile or > from within R for debugging purposes. The functionality of this appears to > have changed and I can't recover it (no pun intended) using the ?options > help page. How can I get the old functionality back, particularly from > within .Rprofile? A specific line entry would be appreciated. An example, > the help page, and sessionInfo() follow. Thanks, MarkI don't think there were any substantial changes in 2.9.0, so I would guess that you have a local object named "recover" or "options", and it is causing your problems. When I run options(error=recover) and your two lines below, I get this output: > options(error=recover) > b.func <- function(x) {y <- x + 2; nonsense; y} > b.func(3) Error in b.func(3) : object 'nonsense' not found Enter a frame number, or 0 to exit 1: b.func(3) Selection: 0 > which is what you wanted. To put this into your .Rprofile, you need to use utils::recover (the utils package hasn't been attached yet). That also works for me. There have been changes to recover in R-devel, Duncan Murdoch> > b.func <- function(x) {y <- x + 2; nonsense; y} >> b.func(3) > Error in b.func(3) : object 'nonsense' not found ## in the past this would > be a menu with numbers for what level I want to go to (in this case just 1) > > This help page states: > 'error': either a function or an expression governing the handling > of non-catastrophic errors such as those generated by 'stop' > as well as by signals and internally detected errors... The > functions 'dump.frames' and 'recover' provide alternatives > that allow post-mortem debugging. Note that these need to > specified as e.g. 'options=utils::recover' in startup files > such as '.Rprofile'. > >> 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 datasets utils methods base > ------------------------------------------------------------ > Mark W. Kimpel MD ** Neuroinformatics ** Dept. of Psychiatry > Indiana University School of Medicine > > 15032 Hunter Court, Westfield, IN 46074 > > (317) 490-5129 Work, & Mobile & VoiceMail > (317) 399-1219 Home > Skype: mkimpel > > "The real problem is not whether machines think but whether men do." -- B. > F. Skinner > ****************************************************************** > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.
Duncan Murdoch
2009-May-30 09:44 UTC
[R] 'options=utils::recover' not working in .Rprofile or within R
[Sent this before completing my last sentence; here's another attempt] On 29/05/2009 11:45 PM, Mark Kimpel wrote:> For years I have been using options(error = recover) either in .Rprofile or > from within R for debugging purposes. The functionality of this appears to > have changed and I can't recover it (no pun intended) using the ?options > help page. How can I get the old functionality back, particularly from > within .Rprofile? A specific line entry would be appreciated. An example, > the help page, and sessionInfo() follow. Thanks, MarkI don't think there were any substantial changes in 2.9.0, so I would guess that you have a local object named "recover" or "options", and it is causing your problems. When I run options(error=recover) and your two lines below, I get this output: > options(error=recover) > b.func <- function(x) {y <- x + 2; nonsense; y} > b.func(3) Error in b.func(3) : object 'nonsense' not found Enter a frame number, or 0 to exit 1: b.func(3) Selection: 0 > which is what you wanted. To put this into your .Rprofile, you need to use utils::recover (the utils package hasn't been attached yet). That also works for me. There have been changes to recover in R-devel (to become 2.10.0), and will likely be more, but what you did shouldn't appear much different than what I showed from 2.9.0 above. If you had sourced the code from a file, 2.10.0 should tell you which line of the file contained the error. Duncan Murdoch> > b.func <- function(x) {y <- x + 2; nonsense; y} >> b.func(3) > Error in b.func(3) : object 'nonsense' not found ## in the past this would > be a menu with numbers for what level I want to go to (in this case just 1) > > This help page states: > 'error': either a function or an expression governing the handling > of non-catastrophic errors such as those generated by 'stop' > as well as by signals and internally detected errors... The > functions 'dump.frames' and 'recover' provide alternatives > that allow post-mortem debugging. Note that these need to > specified as e.g. 'options=utils::recover' in startup files > such as '.Rprofile'. > >> 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 datasets utils methods base > ------------------------------------------------------------ > Mark W. Kimpel MD ** Neuroinformatics ** Dept. of Psychiatry > Indiana University School of Medicine > > 15032 Hunter Court, Westfield, IN 46074 > > (317) 490-5129 Work, & Mobile & VoiceMail > (317) 399-1219 Home > Skype: mkimpel > > "The real problem is not whether machines think but whether men do." -- B. > F. Skinner > ****************************************************************** > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.
Possibly Parallel Threads
- how to list variables enclosed in an environment
- 2.10.0 Under development (unstable) (2009-09-15 r49711) just built segfaults on Debian Squeeze
- XML_1.98-0 fails to build on Debian Lenny with gcc 4.3.2 and R-beta 2.8.0
- help with regular expressions in R
- RSPython won't load in R 2.6.0 under Linux