When there is an error that you don’t understand, you are almost certainly making an assumption that is not true.

Check your assumptions.

Reacting to an error

When you get an error or a warning that you don’t understand, performing the following steps may help you:

  1. Don’t panic.
  2. Guess why it is happening.
  3. Check if your guess is correct.
  4. Repeat steps 1 through 3 as necessary.

The art of debugging is in the generation of the guesses and the proficiency of the checking. You get better with practice.

The state of R error messages

It has been observed that many error and warning messages in R omit important details. I’ll raise my hand to that and plead guilty. But I am trying to rehabilitate myself.

Resources

Circle 8 is a catalogue of possible errors, and begins with a brief introduction to debugging in R.

This has a chapter on how to debug and other advice on programming trouble.

Back to top level of Impatient R

Kommentarer inaktiverade för More R Errors and Such

See more

Explore more content and blog posts.

  • jun 25, 26

    I’d like to do a song of great social and political import. The code that created the illustrations in Tao Te Programming is now available as the TaoTeProgramming package on [...]

  • jun 25, 26

    Another of the all ye entering here. Issue When subscripting an xts object, columns that don’t exist in the object are silently ignored. Example First, create an xts object: xtx [...]

  • jun 25, 26

    Posts by page views Interview with a forced convert to R from Matlab A first step towards R from spreadsheets Plot ranges of data in R A statistical review of [...]