What is the difference between [ ] and [[ ]] in R? -
this question has answer here:
> levels(state.region)[2] [1] "s" > levels(state.region)[[2]] [1] "s"
they return same value, don't know difference between them.
[] = returns object of same class (out of basic object classes), can select more 1 element of object
[[]] = can extract 1 element list or data frame, returned object (out of basic object classes) not list/dataframe
Comments
Post a Comment