Course Content
R Introduction: Part I
1. Basic Syntax and Operations
R Introduction: Part I
Comments
When you've written an extensive script for research and find you need to revisit it later for updates or improvements, remembering the purpose of each line of code can be challenging. That’s where annotations within the code, known as comments, become invaluable.
A comment is a portion of code that isn't executed. To signal to the interpreter which parts should not be processed, we use the #
symbol. For instance, we can add comments in two ways: as a standalone line, and alongside a computation:
The console will only show the result of 11+3
.
Note
While not mandatory, the inclusion of comments is widely regarded as a best practice for maintaining clarity and readability in your code.
Comments are useful not just for clarification, but also for debugging purposes, allowing you to deactivate certain lines of code without deleting them.
Task
The code provided is not executable due to an error. Apply the hash #
symbol to correct the code.
Everything was clear?