It's Autumn! Prices fall like leaves! - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Introduction to lists
Accessing list elements
Unnamed lists
Working with lists
Summary

Instruction

Correct! This also works with lists whose members are named – you can still access a named member based on its position in the list. For example, our candidate list has named members. If you type

candidate[[1]]

you will get Emma's first and last name, the same result you'd get if you were to use

candidate[["name"]]

Exercise

We want to know what job Emma applied for. We don't know the name of the member that stores this information in the candidate list, but we do know that the member is the last one in this list. Display the name of the position for which Emma applied.

Stuck? Here's a hint!

Hint: The position of the last member in the list is equal to the result returned by the length() function when applied to that list, so type:

candidate[[length(candidate)]]