Multi-Line Comment in R

Multi-Line Comment in R, Highlighting the text and pressing Ctrl + Shift + C in RStudio is the simplest way to make a multi-line remark.

Simply highlight the text once more and press Ctrl + Shift + C to erase the comment.

The example that follows demonstrates how to implement this in action.

Multi-Line Comment in R

Let’s say we have the following RStudio script:

The script’s first five rows merely explain what the remaining rows do. We want to make comments out of these rows.

We may select each of the first five rows and press Ctrl + Shift + C to convert the first five lines into a multi-line comment:

Each line has been prefixed with the # sign, indicating that it is a remark in its entirety.

The first five rows can be easily removed from the comment list by selecting each row and hitting Ctrl + Shift + C once more:

Observe that the first five lines no longer contain the # sign, indicating that they are no longer comments.

Note that with OS X, you may accomplish the same task by pressing command + Shift + C.

Top 5 Books on Data Science with Python »

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

2 × 1 =