R Basic Syntax


R Basic Syntax

In this tutorial, we will learn the basic syntax of R language. We will go through the key components of a simple R program.

R Program

print("Hello, World!")

Output

[1] "Hello, World!"

Basic Syntax of an R Program

  1. print("Hello, World!")
    This line uses the print function to output the string "Hello, World!" to the console or standard output.

Key Points to Remember

  • All R statements can be ended with a semicolon (;), but it's typically optional.
  • R is case-sensitive, meaning that print and Print would be considered different.
  • Comments can be added using # for single-line comments or /* ... */ for multi-line comments.
  • R uses vectorized operations and is commonly used for statistical computing and data analysis.