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

Conteúdo do Curso

R Introduction: Part I

R Introduction: Part I

1. Basic Syntax and Operations
2. Basic Data Types and Vectors
3. Factors

bookAssignment Operators

Similar to some other programming languages, R has multiple assignment operators, which we can use interchangeably, at least for now.

In R, specific assignment operators such as <- and -> are available alongside the more universally recognized = operator. At this point, the difference between these operators is not significant, but we will revisit them later when we discuss functions.

Using <- for assignment is similar to using =, with the variable name positioned to the left and the value to the right. Conversely, the -> operator reverses this order. For instance, to assign the value 2020 to the variable year, there are three syntactical options:

Even though the last method of assignment is syntactically correct, it is generally discouraged due to its potential to reduce code readability.

Tarefa
test

Swipe to show code editor

  1. Use the 'equal' (=) operator to assign the result of integer division of 29 by 8 to the variable named equal.
  2. Use the 'left-arrow' (<-) operator to assign the remainder of the division of 29 by 8 to the variable left.
  3. Use the 'right-arrow' (->) operator to assign the equal variable raised to the power of left to the right variable.
  4. Display all three variable values in the order they were created with the cat() function.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 10
toggle bottom row

bookAssignment Operators

Similar to some other programming languages, R has multiple assignment operators, which we can use interchangeably, at least for now.

In R, specific assignment operators such as <- and -> are available alongside the more universally recognized = operator. At this point, the difference between these operators is not significant, but we will revisit them later when we discuss functions.

Using <- for assignment is similar to using =, with the variable name positioned to the left and the value to the right. Conversely, the -> operator reverses this order. For instance, to assign the value 2020 to the variable year, there are three syntactical options:

Even though the last method of assignment is syntactically correct, it is generally discouraged due to its potential to reduce code readability.

Tarefa
test

Swipe to show code editor

  1. Use the 'equal' (=) operator to assign the result of integer division of 29 by 8 to the variable named equal.
  2. Use the 'left-arrow' (<-) operator to assign the remainder of the division of 29 by 8 to the variable left.
  3. Use the 'right-arrow' (->) operator to assign the equal variable raised to the power of left to the right variable.
  4. Display all three variable values in the order they were created with the cat() function.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 10
toggle bottom row

bookAssignment Operators

Similar to some other programming languages, R has multiple assignment operators, which we can use interchangeably, at least for now.

In R, specific assignment operators such as <- and -> are available alongside the more universally recognized = operator. At this point, the difference between these operators is not significant, but we will revisit them later when we discuss functions.

Using <- for assignment is similar to using =, with the variable name positioned to the left and the value to the right. Conversely, the -> operator reverses this order. For instance, to assign the value 2020 to the variable year, there are three syntactical options:

Even though the last method of assignment is syntactically correct, it is generally discouraged due to its potential to reduce code readability.

Tarefa
test

Swipe to show code editor

  1. Use the 'equal' (=) operator to assign the result of integer division of 29 by 8 to the variable named equal.
  2. Use the 'left-arrow' (<-) operator to assign the remainder of the division of 29 by 8 to the variable left.
  3. Use the 'right-arrow' (->) operator to assign the equal variable raised to the power of left to the right variable.
  4. Display all three variable values in the order they were created with the cat() function.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Similar to some other programming languages, R has multiple assignment operators, which we can use interchangeably, at least for now.

In R, specific assignment operators such as <- and -> are available alongside the more universally recognized = operator. At this point, the difference between these operators is not significant, but we will revisit them later when we discuss functions.

Using <- for assignment is similar to using =, with the variable name positioned to the left and the value to the right. Conversely, the -> operator reverses this order. For instance, to assign the value 2020 to the variable year, there are three syntactical options:

Even though the last method of assignment is syntactically correct, it is generally discouraged due to its potential to reduce code readability.

Tarefa
test

Swipe to show code editor

  1. Use the 'equal' (=) operator to assign the result of integer division of 29 by 8 to the variable named equal.
  2. Use the 'left-arrow' (<-) operator to assign the remainder of the division of 29 by 8 to the variable left.
  3. Use the 'right-arrow' (->) operator to assign the equal variable raised to the power of left to the right variable.
  4. Display all three variable values in the order they were created with the cat() function.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Seção 1. Capítulo 10
Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
We're sorry to hear that something went wrong. What happened?
some-alt