The easiest way to create a multi-line comment in RStudio is to highlight the text and press Ctrl + Shift + C.
You can just as easily remove the comment by highlighting the text again and pressing Ctrl + Shift + C.
The following example shows how to do this in practice.
Example: Create Multi-Line Comment in R
Suppose we have the following script in RStudio:
The first five rows of the script simply describe what the rest of the script does. Thus, we want to turn these rows into comments.
To turn the first five lines into a multi-line comment, we can highlight each of the first five rows and press Ctrl + Shift + C:
Notice that the # symbol has been placed in front of each line, which indicates that the entire line is a comment.
We can just as easily uncomment the first five rows by highlighting each row and pressing Ctrl + Shift + C once again:
Note that the # symbol has been removed from each of the first five lines, which indicates that each line is no longer a comment.
Note that you can press command + Shift + C to perform the exact same action in OS-X.
Additional Resources
The following tutorials explain how to perform other common operations in R:
How to Clear the Environment in R
How to Import CSV Files into R
How to Export Data Frame to CSV File in R