1+1[1] 2
William Okech
June 15, 2022
This is the first in a series of blog posts looking at the basics of R and RStudio. These programs allow us to perform various basic and complex calculations.
To get started, first, we will open R or RStudio. In R, go to the console, and in RStudio, head to the console pane. Next, type in a basic arithmetic calculation such as “1 + 1” after the angle bracket (>) and hit “Enter.”
An example of a basic calculation:
The output will be observed next to the square bracket containing the number 1 ([1]).

Additionally, to include comments into the code block we use the hash (#) symbol. Anything written after the code block will be commented out and not run.
Various arithmetic operators (listed below) can be used in R/RStudio.
| Arithmetic Operator | Description |
|---|---|
| + | Addition |
| - | Subtraction |
| * | Multiplication |
| / | Division |
| ** or ^ | Exponentiation |
| %% | Modulus (remainder after division) |
| %/% | Integer division |