'[' - Extract or Replace

  • We can index with the familiar '['
  • It’s an actual R function!
base::'['
## .Primitive("[")
  • '[' behaves differently for atomic vectors, lists, data.frames and many other types
length(methods('['))
## [1] 39
  • It has methods for tons of different object classes!