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.