+ - 0:00:00
Notes for current slide
Notes for next slide

Essentials 08: Common ErroRs

1 / 22

Common ErroRs & Debugging R Code

Different types of helpful info is displayed when there are problems with our code:

2 / 22

Common ErroRs & Debugging R Code

Different types of helpful info is displayed when there are problems with our code:

Messages - the good 😇

  • Often harmless & can sometimes be ignored (i.e. when loading packages)

  • Can sometimes hint that something might be wrong or missing

3 / 22

Common ErroRs & Debugging R Code

Different types of helpful info is displayed when there are problems with our code:

Messages - the good 😇

  • Often harmless & can sometimes be ignored (i.e. when loading packages)

  • Can sometimes hint that something might be wrong or missing

Warnings - the bad 😈

  • Function is executed but something unusual is happening

  • Can highlight potential problems

4 / 22

Common ErroRs & Debugging R Code

Different types of helpful info is displayed when there are problems with our code:

Messages - the good 😇

  • Often harmless & can sometimes be ignored (i.e. when loading packages)

  • Can sometimes hint that something might be wrong or missing

Warnings - the bad 😈

  • Function is executed but something unusual is happening

  • Can highlight potential problems

Errors - the ugly 👹😱

  • Fatal - stops the execution & evaluation of any code

  • Must be solved for code to run & document to knit

5 / 22

Common Causes of ErroRs

Keep these in mind when debugging your own code!

  • Spellig errors, tYpos, incorrect Capitalization & s p a c e s

  • Missing/too many commas, speech marks, brackets, underscores & back ticks

  • Packages not installed/loaded & install.packages commands in code chunks

  • Duplicate code chunk labels

  • Objects being called on before they are created

  • Missing arguments/inputs of functions

  • Incorrect order of function arguments

6 / 22

What To Do?

7 / 22

What To Do?

Step 1: Don't panic - read the error message for clues 🕵

8 / 22

What To Do?

Step 1: Don't panic - read the error message for clues 🕵

Step 2: Find where the error is 📍

  • Error messages in the console tend to give an approx. location of where the problem lies
  • Look for red underline & red crosses
  • Run/knit each chunk in turn from top to bottom
  • Run each line of code in a chunk/each step of a pipeline %>%
9 / 22

What To Do?

Step 1: Don't panic - read the error message for clues 🕵

Step 2: Find where the error is 📍

  • Error messages in the console tend to give an approx. location of where the problem lies
  • Look for red underline & red crosses
  • Run/knit each chunk in turn from top to bottom
  • Run each line of code in a chunk/each step of a pipeline %>%

Step 3: Check over code for common mistakes 👀

  • Typos, brackets, commas, speech marks, spaces..
10 / 22

What To Do?

Step 1: Don't panic - read the error message for clues 🕵

Step 2: Find where the error is 📍

  • Error messages in the console tend to give an approx. location of where the problem lies
  • Look for red underline & red crosses
  • Run/knit each chunk in turn from top to bottom
  • Run each line of code in a chunk/each step of a pipeline %>%

Step 3: Check over code for common mistakes 👀

  • Typos, brackets, commas, speech marks, spaces..

Step 4: Check the output from a function is what you're expecting 🔍

11 / 22

What To Do?

Step 1: Don't panic - read the error message for clues 🕵

Step 2: Find where the error is 📍

  • Error messages in the console tend to give an approx. location of where the problem lies
  • Look for red underline & red crosses
  • Run/knit each chunk in turn from top to bottom
  • Run each line of code in a chunk/each step of a pipeline %>%

Step 3: Check over code for common mistakes 👀

  • Typos, brackets, commas, speech marks, spaces..

Step 4: Check the output from a function is what you're expecting 🔍

Step 5: Use the help pane & package documentation to check function arguments & ordering 📂

12 / 22

What To Do?

Step 1: Don't panic - read the error message for clues 🕵

Step 2: Find where the error is 📍

  • Error messages in the console tend to give an approx. location of where the problem lies
  • Look for red underline & red crosses
  • Run/knit each chunk in turn from top to bottom
  • Run each line of code in a chunk/each step of a pipeline %>%

Step 3: Check over code for common mistakes 👀

  • Typos, brackets, commas, speech marks, spaces..

Step 4: Check the output from a function is what you're expecting 🔍

Step 5: Use the help pane & package documentation to check function arguments & ordering 📂

Step 6: Search the error message online 💻🕸

13 / 22

Common Error Messages

Task: Tell me some possible causes & solutions in the chat!


14 / 22

Common Error Messages

Task: Tell me some possible causes & solutions in the chat!


15 / 22

Common Error Messages

Task: Tell me some possible causes & solutions in the chat!


16 / 22

Common Error Messages

Task: Tell me some possible causes & solutions in the chat!


17 / 22

Common Error Messages

Task: Tell me some possible causes & solutions in the chat!


18 / 22

Common Error Messages

Task: Tell me some possible causes & solutions in the chat!


19 / 22

Common Error Messages

Task: Tell me some possible causes & solutions in the chat!


20 / 22

Common Error Messages

Task: Tell me some possible causes & solutions in the chat!










21 / 22

Made with Padlet
22 / 22

Common ErroRs & Debugging R Code

Different types of helpful info is displayed when there are problems with our code:

2 / 22
Paused

Help

Keyboard shortcuts

, , Pg Up, k Go to previous slide
, , Pg Dn, Space, j Go to next slide
Home Go to first slide
End Go to last slide
Number + Return Go to specific slide
b / m / f Toggle blackout / mirrored / fullscreen mode
c Clone slideshow
p Toggle presenter mode
t Restart the presentation timer
?, h Toggle this help
Esc Back to slideshow