## Comment How about errors and debugging? (Score 2) 159

`I feel that one of the weakest points of R is the error handling, reporting, and debugging available. Do you have advice on tools or techniques for people coding in R (aside from using RStudio? Are there plans for improvements in this area? The current facilities are reminiscent, at least to me, of using gdb back in the 1990s.`

I have in mind cases like the following, in which a confusion about list access using the [ operator (when the [[ should have been used) provides a cryptic error message with no traceback available.

> symlog_scaler <- list(linear_to=2.5, abscissa=2.0,

+ scaling_function=function(x,linear_to=2.5,abscissa=2.0){

+ y <- x; linear_to = abs(linear_to); big_ix = (linear_to<x)

+ y[big_ix] = linear_to + log(1+(x[big_ix] - linear_to), base=abscissa)

+ small_ix = (-linear_to>x)

+ y[small_ix] = -(linear_to + log(1+(-x[small_ix] - linear_to),base=abscissa))

+ y})

> symlog_scaler$scaling_function(-5:5)

[1] -4.307355 -3.821928 -3.084963 -2.000000 -1.000000 0.000000 1.000000 2.000000 3.084963

[10] 3.821928 4.307355

> symlog_scaler['scaling_function'](-5:5)

Error: attempt to apply non-function

> traceback()

No traceback available

>

I have in mind cases like the following, in which a confusion about list access using the [ operator (when the [[ should have been used) provides a cryptic error message with no traceback available.

> symlog_scaler <- list(linear_to=2.5, abscissa=2.0,

+ scaling_function=function(x,linear_to=2.5,abscissa=2.0){

+ y <- x; linear_to = abs(linear_to); big_ix = (linear_to<x)

+ y[big_ix] = linear_to + log(1+(x[big_ix] - linear_to), base=abscissa)

+ small_ix = (-linear_to>x)

+ y[small_ix] = -(linear_to + log(1+(-x[small_ix] - linear_to),base=abscissa))

+ y})

> symlog_scaler$scaling_function(-5:5)

[1] -4.307355 -3.821928 -3.084963 -2.000000 -1.000000 0.000000 1.000000 2.000000 3.084963

[10] 3.821928 4.307355

> symlog_scaler['scaling_function'](-5:5)

Error: attempt to apply non-function

> traceback()

No traceback available

>