Skip to content
Prev 85814 / 398503 Next

srt --- slope text with function?

On Sun, 5 Feb 2006, Duncan Murdoch wrote:

            
'Actually', R does what you ask it to: see options(error).  But before the 
program stops, there is no error to report.  In interactive use I see no 
problem in typing traceback() or using recover() (see below), but for 
batch use we are looking at alternatives.  For example, in R 2.3.0 
(modern) Unix users will get a traceback after a segfault.
filename+lineno makes no sense: R functions are not (in the main) from 
files.  They can be autogenerated (and often are).  And I can 'fix' them.

As for the call stack, try options(error=recover) and 'where': see the 
chapter Duncan pointed you to.
In the debugging context the command 'where' tells you the sequence of 
calls (which can be more helpful).

More generally, functions need not even have names (Bill Venables calls 
them 'anonymous functions'), as in

     r <- sapply(nms,
                 function(n) if (exists(n, envir = envir, mode = mode))n
                             else as.character(NA))

from ls.str.