From pburns at pburns.seanet.com  Thu Dec 18 13:19:21 2003
From: pburns at pburns.seanet.com (Patrick Burns)
Date: Thu Dec 18 13:17:54 2003
Subject: [Rd] a debugging difficulty
Message-ID: <3FE19B49.9000701@pburns.seanet.com>

I had an error to debug that turned out to be essentially:

 > NULL * matrix(1:4, 2)
Error: dim<- length of dims do not match the length of object


The equivalent of the NULL was a variable that was meant
to be a scalar.  It took me a while to track down the problem
because I was focusing on looking for arrays that were different
than my expectation.

I think it could save substantial debugging time if the error message
stated the dims and the length of the object.

Also with

options(error=dump.frames)

set before the command above, we get:

 > debugger()
Message:  Error: dim<- length of dims do not match the length of object
Available environments had calls:
1:
0:

Enter an environment number, or 0 to exit  Selection: 1
Selection: 0
 >

That is, there is apparently an environment to select, but
trying to select it doesn't do anything.

This is with R version 1.8.1 on Windows and SuSe 8.2 (both precompiled).


Patrick Burns

Burns Statistics
patrick@burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")


[Rd] a debugging difficulty
Patrick Burns