Introduction
3. Multiplication and division
Text values
Variables
Functions
Summary

Instruction

Good! R can also perform other computations, like multiplication and division. Multiplication uses the * operator, while division uses the / operator.

Tanya works as a consultant and earns $350 on a daily basis. We can calculate how much she earns each week (assuming there are only 5 working days in her week and that she doesn't work overtime):

5 * 350

R will print the result of Tanya's weekly earnings: 1750 (dollars).

If we're instead told that Tanya worked 5 days last week and earned $1750, we would calculate her daily rate with the help of the division operator:

1750 / 5

This expression returns Tanya's daily rate of 350 (dollars).

Exercise

Tanya is from the US, so she's more familiar with pounds than kilograms as a measure of weight. Given that 1 kilogram is equal to 2.20462 pounds, convert Tanya's ideal weight of 62 kg to pounds.