Arithmetic with R

  In its most basic form, R can be used as a simple calculator. Consider the following arithmetic operators:

The last two might need some explaining:

With this knowledge, follow the instructions below to complete the exercise.

Instruction

# An addition 5 + 5 # A subtraction 5 - 5 # A multiplication 3 * 5 # A division (5 + 5) / 2 # Exponentiation # Modulo # An addition 5 + 5 # A subtraction 5 - 5 # A multiplication 3 * 5 # A division (5 + 5) / 2 # Exponentiation 2 ^ 5 # Modulo 28 %% 6 msg = "Do not remove the other arithmetic examples!" test_output_contains("2^5", incorrect_msg = "The exponentiation example is not correct. Write `2 ^ 5` on a new line.") test_output_contains("28 %% 6", incorrect_msg = "There seems to be an issue with the modulo example. Write `28 %% 6` on a new line.") success_msg("Great! Head over to the next exercise.")

Previous: 1-1 | How it works

Next: 1-3 | Variable assignment

Back to Main