data science sub
Arithmetic with R
In its most basic form, R can be used as a simple calculator. Consider the following arithmetic operators:
- Addition:
+
- Subtraction:
-
- Multiplication:
*
- Division:
/
- Exponentiation:
^
- Modulo:
%%
The last two might need some explaining:
- The
^
operator raises the number to its left to the power of the number to its right: for example3^2
is 9. - The modulo returns the remainder of the division of the number to the left by the number on its right, for example 5 modulo 3 or
5 %% 3
is 2.
With this knowledge, follow the instructions to complete the exercise.
Comments
Post a Comment