If I have a matrix of this form
g = matrix(c(1,1,1,0,1,1,0,0,1),3,3,byrow=T)
How can I turn it into a matrix of this form?
g = matrix(c(1,1,1,1,1,0,1,0,0),3,3,byrow=T)
If I have a matrix of this form
g = matrix(c(1,1,1,0,1,1,0,0,1),3,3,byrow=T)
How can I turn it into a matrix of this form?
g = matrix(c(1,1,1,1,1,0,1,0,0),3,3,byrow=T)
We can reverse the column sequence index and specify it in j
g1 <- g[, ncol(g):1]
Or use rev
g[, rev(seq_len(ncol(g)))]