Great! Before we wrap up this part, it's time to briefly review what we learned.
Lists are data structures that allow you store data of any type as their members – even lists and data frames.
You can access the members of a list using the:
- double-bracket operator:
job_role[["skills"]]
- dollar-sign operator:
job_role$skills
The single-bracket operator is used for list slicing – that is, it always creates a sublist. The double-bracket and dollar-sign operators are used to retrieve a single member of a list. They do not create a sublist.
job_role_no_names[c(1, 2)]
You can modify, create, and delete list members using any of the above operators. Deleting a list member requires that you assign the value of NULL
to the appropriate list member.
shortlist[[2]] <- NULL
In this summary quiz, we'll be preparing a final list of candidates who have entered the final round of consideration for the data scientist role. This list will be sent to your upper management for final interviews.
Your company's recruiter made some final phone calls to the candidates; based on these calls, he needs to make a few rearrangements to the existing data. Let's help him in R.
We've created a list aptly named shortlist
. It contains information about the final candidates we'll be considering for the position. Each member of this list corresponds to one individual candidate (also stored in a list).