So far, we've only looked at lists whose members are named, but that's not always going to be the case – members can be unnamed. Let's look at the job_role
list again. This time, we'll call the list job_role_no_names
for clarity.
[[1]]
[1] "Data scientist"
[[2]]
[1] 10
[[3]]
[1] "R" "Python" "Spark" "Cloudera" "Hive" "Impala"
Notice that we can't see any member names in this list – there's no dollar sign followed by a name. Instead, we see sequential numbers in double brackets: [[1]]
, [[2]]
, and [[3]]
. These are the positions of the list's members. So [[1]]
denotes the first member of the list, [[2]]
the second one, and so on.