Learning Objectives
- Start Coding in R
- Basic Arithmetic Operations in R
Execute Your First Code in R
Comments in R
- When writing code in R, it's essential to make sure that your code can be easily understood by others, say by your friend who wants to see it. This can be done with a comment. Comments can be specified to explain what your code does.
- R ignores everything after the hash mark and up to the end of the line. You can insert them anywhere in your code!

Operators in R
- Operators are used to perform operations on variables and values.
- Some of the operators that R supports are listed below:
- Arithmetic operators
- Comparison operators
- Assignment operators
- Logical operators
- Let's see some of the well-known operators.
Arithmetic Operator
- Used with numeric values to perform common mathematical operations.
- The addition, subtraction, multiplication, etc., operations come under this category.
- Example:
x = 2
y = 3
x + y # Addition
x * y # Multiplication

Comparison Operator
- Used to compare two values
- Gives a boolean result (True/False)

Variables
- A variable can be considered a storage container for data.
- Every variable will have a name.
- It is a good way to store information while making it easy to refer to that information in our code later.

- For instance, instead of working with the number 3.14, we can assign it to a variable pi and use it as many times as we want later.
- The equal sign (=) is used to assign values to variables.
- The syntax for assigning values to a variable is as follows: Variable name = value or information
- Example:
x = 5
y = "John" - In the video coming up, the tutor will discuss the following things in the hands-on tutorial:
- How to assign values to object is R using the equal sign (=) or less than sign with dash
- How to use the ls function to see the data stored in R
- How to use the rm function to remove an object in R
- How to add, subtract, multiply, and divide in R
- How to use the sqrt function in R to find the square root of an object
- How to use the log function in R to calculate logarithms
- How to use the exp function in R to take the exponent or anti-log
- How to use the abs function in R to calculate the absolute value
- and a few handy keyboard shortcuts in R