[Rd] a debugging difficulty
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Dec 18 13:52:52 MET 2003
The error message is easy to expand, and R is a bit inconsistent as we do
have
error("length of dimnames[%d] not equal to array extent",i+1);
I've seen similar things debugging recently, and don't know the cause.
On Thu, 18 Dec 2003, Patrick Burns wrote:
> 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 at 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")
>
> ______________________________________________
> R-devel at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
>
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-devel
mailing list