Small gotcha when using negative indexing
Negative indexing is a commonly used method in R to drop elements from a vector or rows/columns from a matrix that the user does not want. For example, the code below drops the third column from the matrix M:
M <- matrix(1:9, nrow = 3)
M
# [,1] [,2] [,3]
# [1,] 1 4 7
# [2,] … Continue reading