Learn

Let’s start with the basic syntax for mathematical calculations in R. R performs addition, subtraction, multiplication, and division with +, -, *, and /:

# Results in "500" 573 - 74 + 1 # Results in "50" 25 * 2 # Results in "2" 10 / 5

Mathematical operations in R follow the standard mathematical order of operations. Let’s write your first line of R code and calculate some basic math!

Instructions

1.

Calculate the result of this equation: 25 * 4 + 9 / 3 in the R code block in your notebook.Rmd R-markdown file. Before you press run, try to figure out what the answer would be based on the order of operations. Your answer should match the output!

Take this course for free

By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?