> levels(state.region)[2]
[1] "S"
> levels(state.region)[[2]]
[1] "S"
They return the same value, so I don't know what is the difference between them.
> levels(state.region)[2]
[1] "S"
> levels(state.region)[[2]]
[1] "S"
They return the same value, so I don't know what is the difference between them.
[] = 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