> 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With