Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Access the n-the element of a vector

  • It is some_vector[n]
  • It is 1-based
distances = c(11, 12, 13, 14)

distances[1]        # 11
distances[4]        # 14
distances[5]        # NA