To create a multiple line comment in R, you can use two different ways.

The following methods show how you can do it with syntax.

Method 1: Use # Symbol

#

Method 2: Use Shortcuts

You can add multi line comment in by just pressing Ctrl + Shift + C from keyboard.

Let see how can create multi line comment in R.

Create Multi-Line Comments Using # Symbol

Let’s see how we can add multiline comment in R.

# print("This shows before creating multi line command")
# print("After creating multi line command")
# print("Hello R Language")

print("Hello R Language")

Output:

[1] "Hello R Language"

Here the output show string that we showed using print() function. Also we try to print other statement but make them as comment so it will not print.