[R] Error Running arules

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Tue Sep 6 22:36:05 CEST 2022

On Tue, 6 Sep 2022 15:47:20 -0400
"Stephen H. Dawson, DSL" <service using shdawson.com> wrote:

> I added the line to the top of my script:
> traceback()

The best way to use traceback() is to run it immediately after getting
an error:

f <- function() g()
g <- function() h()
h <- function() stop("I'm causing an error")
# Error in h() : I'm causing an error
# 4: stop("I'm causing an error") at #1
# 3: h() at #1
# 2: g() at #1
# 1: f()

Depending on how you run scripts, placing a traceback() right after the
line that crashes may be not enough: R stops the whole execution
process, requiring you to type traceback() manually. Alternatively,
options(error = traceback) will run it for you every time an unhandled
error happens, including interrupts (which is annoying).

options(error = recover) will let you interactively inspect the values
of the variables at the time of the crash. Using dump.frames (see its
help page) will save the variables into file or global variable to
inspect them later. I haven't seen them shared on the mailing list (too
large?), but it could be an option. options(error = NULL) restores the
default behaviour.

When debugging is unavoidable, R Inferno
<https://www.burns-stat.com/documents/books/the-r-inferno/> is one of
good resources on how to do it with R code.

> I ran my script with my arules code today. Now, there are no errors.

Congratulations on having it solve itself! Let's hope the error won't

Best regards,

More information about the R-help mailing list