English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Comments are mainly used to explain a piece of code, making it easier for readers to understand. Programming language comments are ignored by the compiler and will not affect the execution of the code.
Generally, programming language comments are divided into single-line comments and multi-line comments, but R language only supports single-line comments, and the comment symbol is #.
In fact, if there are multi-line comments, we just need to add the # symbol to each line.
# This is my first programming code myString <- "Hello, World!" print ( myString )
# R Language Implementation of Adding Two Numbers # Variable Assignment a <- 9 b <- 4 # Output Result print(a + b)
In fact, there is another workaround for multi-line comments, which is to use if language, as shown in the following example:
if(FALSE) { " This is an example of a multi-line comment Comment content is placed between single quotes or double quotes " } myString <- "Hello, World!" print ( myString )