[R] left transpose

2013-10-21 Thread Vokey, John
useRs, I frequently require the following transform of a matrix that I call a leftTranspose: -- transposes x such that the last items of each row become -- the first items in each column. E.g., -- a b c d -- e f g h -- becomes: -- d h -- c g -- b f -- a e because

Re: [R] left transpose

2013-10-21 Thread Jorge I Velez
Dear Dr. Vokey, Here is one approach, although may not be the more efficient: x - matrix(1:8, ncol = 4) x # [,1] [,2] [,3] [,4] #[1,]1357 #[2,]2468 t(x[, ncol(x):1]) # [,1] [,2] #[1,]78 #[2,]56 #[3,]34 #[4,]12