Comments

Comments are not executed in R, start with the character # and end with the end of the line.

Input:

source_code/appendix_b_r/example01_comments.r
print("This text is printed because the print statement is executed")
#This is just a comment and will not be executed.
#print("Even commented statements are not executed.")
print("But the comment finished with the end of the line.")
print("So the 4th and 5th line of the code are executed again.")

Output:

$ Rscript example01_comments.r 
[1] "This text will be printed because the print statemnt is executed"
[1] "But the comment finished with the end of the line."
[1] "So the 4th and 5th line of the code are executed again."
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset