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

bookAssignment Operators

R provides several operators for assigning values to variables.

year = 2020
year <- 2020
2020 -> year

However, -> is rarely used because it reduces code readability.

Note
Note

Going forward, assignments will be shown using the left arrow (<-) and the equal sign (=).

Task

Swipe to start coding

  1. Use the equal sign (=) to assign the result of 29 %/% 8 to the variable named equal.
  2. Use the left arrow (<-) to assign the result of 29 %% 8 to the variable named left.
  3. Use the right arrow (->) to assign the result of equal ^ left to the variable named right.
  4. Print the values of equal, left, and right in sequence using the cat() function.

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 10
single

single

Ask AI

expand

Ask AI

ChatGPT

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

close

Awesome!

Completion rate improved to 2.27

bookAssignment Operators

Swipe to show menu

R provides several operators for assigning values to variables.

year = 2020
year <- 2020
2020 -> year

However, -> is rarely used because it reduces code readability.

Note
Note

Going forward, assignments will be shown using the left arrow (<-) and the equal sign (=).

Task

Swipe to start coding

  1. Use the equal sign (=) to assign the result of 29 %/% 8 to the variable named equal.
  2. Use the left arrow (<-) to assign the result of 29 %% 8 to the variable named left.
  3. Use the right arrow (->) to assign the result of equal ^ left to the variable named right.
  4. Print the values of equal, left, and right in sequence using the cat() function.

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Β 10
single

single

some-alt