Skip to content

robertzk/bettertrace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Better Stack Trace for R Build Status Coverage Status

R has long suffered from poor stack tracing capabilities. This package aims to make the situation slightly better by providing more details when errors occur.

For example, if we have a file "/Users/robertk/tmp/foo.R",

# /Users/robertk/tmp/foo.R
foo <- function() { bar() + 1 }
bar <- function() { baz() + 2 }

then sourcing and calling foo gives

# R console
source("~/tmp/foo.R")
foo()
# Error in bar() : could not find function "baz"
# In global environment: foo()
# In /Users/robertk/tmp/foo.R:1: bar() + 1
# In /Users/robertk/tmp/foo.R:2: baz() + 2
# 
# could not find function "baz"

bettertrace example

This is much more informative than the built-in message:

> foo()
Error in bar() : could not find function "baz"

worse trace example

Installation

This package is not yet available from CRAN (as of April 2, 2015). To install the latest development builds directly from GitHub, run this instead:

if (!require("devtools")) install.packages("devtools")
devtools::install_github("robertzk/bettertrace")
library(bettertrace) # options(error = bettertrace::stacktrace) will be set

About

Better stack trace for R

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages