What is the difference between [ ] and [[ ]] in R? [duplicate]

[] = always returns object of same class (out of basic object classes), can select more than one element of an object

[[]] = can extract one element from list or data frame, returned object (out of basic object classes) not necessarily list/dataframe

Leave a Comment