174k views
2 votes
Which of the following are valid methods of assigning data (in this case the value 9) to a variable in the R environment?

(Select all that apply, omit those that do not.)
a) i < - 9
b) 9 -> i
c) i = 9
d) o < - i
e) 9 = i

User MattMS
by
8.3k points

1 Answer

5 votes

Final answer:

The valid methods of assigning the value 9 to a variable in R are using '9 -> i' and 'i = 9', while 'i < - 9' contains a typo and would be correct as 'i <- 9'. So the correct answer is option A.

Step-by-step explanation:

The question relates to different syntaxes for assigning values to variables in the R programming language. The valid methods to assign the value 9 to a variable in the R environment are:

  • a) i < - 9: This is a valid assignment but has a syntax error due to the space between < and -. Without the space, i <- 9 would be correct.
  • b) 9 -> i: This syntax is correct and assigns the value 9 to the variable i.
  • c) i = 9: This is a valid and typical assignment statement in R.

The following are not valid methods for assigning data to a variable:

  • d) o < - i: This is not an assignment of the value 9 but rather an incorrect attempt to assign the value of variable i to variable o and also has a syntax error similar to option a).
  • e) 9 = i: This syntax is incorrect in R as it tries to assign the variable i to the value 9, which is not permissible.

User Pavel Feldman
by
8.9k points

No related questions found

Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.