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:

# a number
marks <- 96

# display the marks
Marks

Output

[1] 96

Multi-line Comments

The # (hash) can be used in Python for multiline comments. Just add a # before every comment:

# the marks of a student is stored as
# a number
marks <- 99

# display the marks of a
# student in R
marks

Output

[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:

First R Program
R Variables
Studyopedia Editorial Staff
[email protected]

We work to create programming tutorials for all.

No Comments

Post A Comment