Comments are lines in your code that are ignored by the R interpreter. They are used to explain your code or leave notes for yourself or others reading the code. Comments help make your code easier to understand and maintain.
In R, a comment starts with the #
symbol. Anything after #
on that line is considered a comment.
# This is a comment in R x <- 10 # Assign 10 to variable x # Comments can be on their own line or after code y <- 20 # Assign 20 to y
# Calculate the area of a rectangle length <- 5 # length of rectangle width <- 3 # width of rectangle area <- length * width # multiply length and width to get area area # display the area
Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!