0
0
R Programmingprogramming~10 mins

Variable assignment (<- and =) in R Programming - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to assign the value 10 to the variable x using the assignment operator.

R Programming
x [1] 10
Drag options to blanks, or click blank then click option'
A->
B=
C<-
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' which is for comparison, not assignment.
Using '->' which assigns in the opposite direction.
2fill in blank
medium

Complete the code to assign the value 5 to the variable y using the equals sign.

R Programming
y [1] 5
Drag options to blanks, or click blank then click option'
A<-
B->
C==
D=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' which is for comparison, not assignment.
Using '<-' which is also correct but not the answer here.
3fill in blank
hard

Fix the error in the code to correctly assign 20 to variable z.

R Programming
z [1] 20
Drag options to blanks, or click blank then click option'
A<-
B==
C->
D=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' instead of an assignment operator.
Using '->' which assigns in the wrong direction.
4fill in blank
hard

Fill both blanks to assign 15 to a and 25 to b using the correct operators.

R Programming
a [1] 15
b [2] 25
Drag options to blanks, or click blank then click option'
A<-
B=
C==
D->
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' which is for comparison.
Using '->' which assigns in the wrong direction.
5fill in blank
hard

Fill all three blanks to assign values 100, 200, and 300 to variables x, y, and z respectively using correct assignment operators.

R Programming
x [1] 100
y [2] 200
z [3] 300
Drag options to blanks, or click blank then click option'
A<-
B=
C->
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' instead of assignment.
Using '->' which assigns in the wrong direction.