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

Perfect! You can also use the str() function to see details about the structure of a list. For example, by typing str(candidate), you will see something like this:

List of 6
$ name                    : chr "Emma Stone"
$ age                     : num 35
$ country                 : chr "England"
$ profession              : chr "Data analyst"
$ languages               : chr [1:3] "English" "Dutch" "French"
$ prior_working_experience:'data.frame': 3 obs. of  3 variables:
 ..$ year    : Factor w/ 3 levels "2001- 2007", "2007-2011", ..: 3 2 1
 ..$ company : Factor w/ 3 levels "Nestico", "Terramy", ..: 3 2 1
 ..$ job_role: Factor w/ 2 levels "data analyst", ..: 1 1 2

The str() function displays the number of elements in the list (6) and their names, types, and values. This is useful when you want to know how a list's members are structured.

Exercise

Use str() to examine the structure of the job_role list.