[R] Error: (subscript) logical subscript too long

Douglas Bates bates at stat.wisc.edu
Sat Sep 22 00:44:50 CEST 2007


On 9/21/07, René Holst <rho at difres.dk> wrote:
>
> As part of a larger program I have a rather long and involved sub-procedure which fails to work, It manipulates some large matrices, stored to the disc. The procedure halts with the message:
>
> Error: (subscript) logical subscript too long
>
> Can anyone give advice about what may cause this error and how it can be remedied - I feel confident that it is not a syntactically or logical error.

You need to find out where the error message originated.  Use
traceback() for that.  Then, if necessary, use
debug(functionWithError) to set the debugger on the point where the
problem originates and find out what subscripting operation is causing
the problem.

You may be confident that it is not a logical error but such things
are surprisingly crafty in how they can worm their way into your code.
 I almost never quote Ronald Reagan except for his suggestion that you
"Trust, but verify".



More information about the R-help mailing list