Complete the code to assign the value 10 to the variable x using the assignment operator.
x [1] 10
In R, the common way to assign a value to a variable is using the left arrow operator <-.
Complete the code to assign the value 5 to the variable y using the equals sign.
y [1] 5
In R, you can also assign values using the equals sign =.
Fix the error in the code to correctly assign 20 to variable z.
z [1] 20
The operator <- correctly assigns the value 20 to variable z. The operator == is for comparison and causes an error here.
Fill both blanks to assign 15 to a and 25 to b using the correct operators.
a [1] 15 b [2] 25
Both <- and = can be used for assignment in R. Here, <- assigns 15 to a, and = assigns 25 to b.
Fill all three blanks to assign values 100, 200, and 300 to variables x, y, and z respectively using correct assignment operators.
x [1] 100 y [2] 200 z [3] 300
Use <- or = for assignment. Here, <- assigns to x and z, and = assigns to y. The operator -> assigns in the opposite direction, and == is for comparison.