[R] Cryptic error for mscmt function

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Mon Nov 6 15:08:36 CET 2023

В Sun, 5 Nov 2023 13:35:39 +0000
"Leu  Thierry" <thileu using student.ethz.ch> пишет:

> However, when trying to run it I get a very cryptic error message
> saying  "Error in lst[[nam]][intersect(tim, rownames(lst[[nam]])),
> cols, drop = FALSE]: subscript out of bounds".

Without a way to reproduce the error, I can offer a few bits of generic

1. Use traceback() to find out where the error happens. You can then
type the name of the function at the R prompt to read its source code
(although most likely without the comments).

2. Even better, set options(error = recover) before running your code
and have the debugger launched at the point where the error happens.
Use the debugger (see help(browser) to look at every variable and find
out why indeed lst[[nam]] doesn't seem to contain rows with names
intersect(tim, rownames(lst[[nam]])) and/or columns with names `cols`.

3. See the free book The R Inferno
<https://www.burns-stat.com/documents/books/the-r-inferno/> for more
advice on debugging R code.

Best regards,

More information about the R-help mailing list