Elegant indexing up to end of vector/matrix
Sometimes it’s easier to tell R what you don’t want. In other words, exclude columns from the matrix using negative indexing: Here are two alternative ways that both produce the same results: A[, -(1:2)] A[, -seq_len(2)] Results: [,1] [,2] [,3] [,4] [,5] [,6] [1,] 3 4 5 6 7 8 [2,] 3 4 5 6 … Read more