[Solved] Why does indexing into a list with list[n] instead of list[[n]] in R not do what you would expect? [duplicate]
Because in general l[n] returns a sublist (possibly of length one), whereas l[[n]] returns an element: > lfile[2] [[1]] [1] “file2.xls” # returns SUBLIST of length one, not n’th ELEMENT > lfile[[2]] [1] “file2.xls” # returns ELEMENT From R intro manual: 6.1 Lists: It is very important to distinguish Lst[[1]] from Lst[1]. ‘[[…]]’ is the … Read more