R as a Calculator

At its most basic, R can be used as a calculator. As you would expect, you can use all the standard mathematical operators:

  • Addition (+) & Subtraction (-)

  • Multiplication (*) & Division (/)

  • Exponentiation (^)

2 + 2
[1] 4
100 / 20
[1] 5
3 ^ 3
[1] 27


Of course, R is much more than a simple calculator! In the following sections, you’ll learn the building blocks of R that we’ll rely on throughout the entire course.