FAQ: Introduction to R Syntax - Calculations

This community-built FAQ covers the “Calculations” exercise from the lesson “Introduction to R Syntax”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Learn R

FAQs on the exercise Calculations

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Hi,

In the introduction to R Syntax under “Calculations” I believe there is an error (unless I’m missing something). The error

Results in “500”

573 - 74 + 1

^ in the above, if we’re working with good old order of operations of “PEMDAS” addition should happen prior to subtraction. So it would be 74+1=75 and then 573-75=498

Or have I missed something?

I know this is a small detail but I became obssesed with it and I’m grateful for your thoughts…

1 Like

Hello, I entered the following “25 * 4 + 9 / 3” under the notebook.Rmd but when I pressed “Run” I did not get a numeric result. Instead I got a message that says “Did you calculate the equation inside your R notebook?”…I thought notebook.Rmd was the R notebook…am I missing something?

Thank you!

Hello, @pyace87095.

Sorry, for replying so late, but I just noticed your post.

You’ve ignored the sign. 74 is a negative number. If you want to do the addition first, you have to add 1 to -74. That gives you -73. 573 - 73 = 500. Addition and subtraction is essentially a sum of a list of values. You have 3 values here: 573, -74, 1.

Hello, @ashleybarnes00527705, and welcome to the forums.

Sounds like you may have not entered your code in the correct space, or if you included the quotation marks like you show in your post, that would be an issue as well.
image

Your code should go where I’ve indicated in the screenshot.
Happy coding!