0
0
R Programmingprogramming~10 mins

Assignment operators 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.

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 a comparison operator, 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 rightward assignment operator.

R Programming
5 [1] y
Drag options to blanks, or click blank then click option'
A<-
B->
C=
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<-' which assigns leftward.
Using '==' which is for comparison.
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 is valid but less common in R for assignment.
4fill in blank
hard

Fill both blanks to assign the value 15 to variable a using the standard assignment operator and then print a.

R Programming
a [1] 15
print([2])
Drag options to blanks, or click blank then click option'
A<-
Ba
Cprint
D->
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'print' as the assignment operator.
Printing the wrong variable.
5fill in blank
hard

Fill all three blanks to assign 30 to variable b, then assign b's value to c, and finally print c.

R Programming
b [1] 30
c [2] b
print([3])
Drag options to blanks, or click blank then click option'
A<-
B->
Cc
Db
Attempts:
3 left
💡 Hint
Common Mistakes
Using the rightward assignment operator incorrectly.
Printing the wrong variable.