I want to index a matrix m*n by specifing row and column but when the m or n becomes 1, you cant index it as a matrix but as a vector:
M=matrix(c(1,2,3,4),nrow=2)
M[1,] #Works
M=M[-1,]
M[1,] #Doesn't work
Is there any workaround instead of using if/else to check for the length of m/n?