08 Feb R Comments
Comments in R programming provide extra details about various aspects of a program. They are usually included at the start of a program to indicate its purpose, author, and the date on which it was written. They also provide clarification about complicated statements in the program. On executing the program, R will not consider it a program statement and will ignore it.
Single-line Comments
The # (hash) is used in R for single-line comments. Let us see an example to learn how to implement single-line comments in R:
1 2 3 4 5 6 7 |
# a number marks <- 96 # display the marks Marks |
Output
1 2 3 |
[1] 96 |
Multi-line Comments
The # (hash) can be used in Python for multiline comments. Just add a # before every comment:
1 2 3 4 5 6 7 8 9 |
# the marks of a student is stored as # a number marks <- 99 # display the marks of a # student in R marks |
Output
1 2 3 |
[1] 99 |
If you liked the tutorial, spread the word and share the link and our website Studyopedia with others.
For Videos, Join Our YouTube Channel: Join Now
Read More:
No Comments