datacarpentry / R-ecology-lesson

Data Analysis and Visualization in R for Ecologists
https://datacarpentry.org/R-ecology-lesson/
Other
314 stars 508 forks source link

Guidance on red "X" warnings in RStudio script window #659

Closed mlonneman closed 4 years ago

mlonneman commented 4 years ago

It would be useful to include guidance on how to interpret RStudio’s diagnostic warnings in the script window, particularly the red “X” that appears when RStudio senses missing commas or closing parentheses or brackets. In my experience, a handful of learners end up with a cascade of red “X” icons throughout their script due to one or more missing characters. However, it isn’t clear to learners how to interpret this (is each line of code incorrect in isolation or is it an issue with only one line that would create an error if the entire script was run?). Unless a helper intervened, leaners would simply continue following along with the lesson until an error in the console forced them to seek help.

image

In the above screenshot, the only mistake is the missing closing parenthesis “)” on line 4. While it’s likely the learner will eventually get an error, it’s possible for learners to advance through an entire lesson while ignoring the warnings without generating an error, perhaps because they are not running the line of code that has the initial mistake. While this may not be an issue of great importance, I think it can harm the confidence of students learning to code for the first time if it goes unnoticed by helpers or teachers. While the code they are running may operate error-free all or most of the time, the red X on each line likely is a sinister reminder that they are still doing something wrong.

It’s relatively easy for helpers to recognize and provide feedback on how to respond to this issue in in-person courses as they can quickly scan the learners screen. In that context, I think adding content to the “teaching notes” document would be appropriate to let instructors and helpers be aware of this teaching point. However, if carpentry courses moved online to Zoom due to the pandemic or another reason, it becomes harder to recognize if learners are experiencing this issue. In that case, it may be useful to include a brief statement about diagnostics in the “seeking help” or similar section of the “Before we start” lesson.