Knowledge Quiz: Lists

Note
  • Click the check-mark button to check your answer.
  • Click the question-mark button to see an explanation of the solution.

Consider the following list, l1.

$name
[1] "bob"

$age
[1] 25

$height
[1] 180

$eyes
[1] "blue"

Which of the following expressions will change the value of the eyes slot in l1 from “blue” to “green”?

  • Wrong: This command doesn’t actually change anything.
  • Correct
  • Wrong: There is no slot named “4” in l1.
  • Wrong: This command will change the name of the fourth slot, not the contents of that slot.
  • Wrong: We’re replacing the value of l4$eyes with the contents of the object green, not the character vector "green".
Back to top