Comment lines include the line of code or any sort of information that mainly specifies the other programmers (apart from the one who designed the code) about the functionality of that particular piece of code where the comment lines are included. The use of these comment lines is that it makes the program more precise.
In the R language, the comment lines act as the helping text. Comment lines are ignored by the interpreter when the program is being executed.
Types of Comments
- Single-line comments- Comment that only needs one line
- Multi-line Comments- Comment that requires more than one line.
- Documentation Comments- Comments that drafted usually for a quick documentation lookup
The basic syntax of using a single comment
# My first comment in R
To comment a single line in RStudio, we can put “#” before each line.
But when we want to comment multiple lines at one go, we can use following in RStuido
In Windows: CTRL + SHIFT + C
In OS-X: COMMAND + SHIFT + C
# My first multiline comment
# Line 2
# Line 3
# End of multiline comment
and for uncommenting the multiple lines at once, use the same
In Windows: CTRL + SHIFT + C
In OS-X: COMMAND + SHIFT + C
Conclusion
Hence, we saw how to make comments in R.
This brings the end of this Blog. We really appreciate your time.
Hope you liked it.
Do visit our page www.zigya.com/blog for more informative blogs on Data Science
Keep Reading! Cheers!
Zigya Academy
BEING RELEVANT