Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
2. Numbers and basic arithmetic
Text values
Variables
Functions
Summary

## Instruction

We're off to a good start! Of course, R can do much more than just spit back a number you provide. You can ask it to perform calculations like addition (+) or subtraction (-).

Let me introduce you to John and Tanya. The young couple just started living together, and they are still just getting used to sharing their finances. John and Tanya earn monthly salaries of $6540 and$5650, respectively. We can use R to calculate their total monthly income:

6540 + 5650

This expression computes the result and returns 12190, the combined monthly income of John and Tanya.

John received a monthly salary of $6540. He spent$1045 on his photography equipment. This expression calculates how much money he still has:

6540 - 1045

R will return 5495, the amount of John's money that remains.

## Exercise

Tanya would like to check what her ideal weight should be so she can adjust her fitness routine accordingly. She found several formulas online for calculating the ideal weight for women.

One such resource says that the ideal weight is defined as:

height (in cm) - 110

Write a line of code to calculate Tanya's ideal weight, given that she is 172 cm tall.