Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Basic Arithmetic | Basic Syntax and Operations
R Introduction: Part I

Swipe to show menu

book
Basic Arithmetic

Unlike many other programming languages, R doesn't need a specific function to display output. So, let's begin our R journey with some simple arithmetic to get started.

In R, you can perform basic arithmetic using the following operators:

  • + for addition;

  • - for subtraction;

  • * for multiplication;

  • / for division.

For example, let's compute a few mathematical expressions:

123
12 + 21 32 - 16 10 * 11
copy

As you can see, there's nothing complicated here.

Task

Swipe to start coding

Perform the following calculations using basic arithmetic operations:

  1. 30 + 24;
  2. 50 - 36;
  3. 19 * 7.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 2
We're sorry to hear that something went wrong. What happened?

Ask AI

expand
ChatGPT

Ask anything or try one of the suggested questions to begin our chat

book
Basic Arithmetic

Unlike many other programming languages, R doesn't need a specific function to display output. So, let's begin our R journey with some simple arithmetic to get started.

In R, you can perform basic arithmetic using the following operators:

  • + for addition;

  • - for subtraction;

  • * for multiplication;

  • / for division.

For example, let's compute a few mathematical expressions:

123
12 + 21 32 - 16 10 * 11
copy

As you can see, there's nothing complicated here.

Task

Swipe to start coding

Perform the following calculations using basic arithmetic operations:

  1. 30 + 24;
  2. 50 - 36;
  3. 19 * 7.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 2
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
We're sorry to hear that something went wrong. What happened?
some-alt