How to Solve R Error: Subscript out of bounds

If you try to access a column or row that does not exist, you will raise the error Subscript out of bounds. You can use nrows(matrix) to find the number of rows of a matrix, ncol(matrix) to find the number of columns in a matrix and dim(matrix) to find the number of...