Rによる転置行列の生成

Reference
https://twitter.com/R_Programming/status/620437623371214850
> example<-matrix(1:10, nrow=2, ncol=5, byrow=T) 

> example
     [,1] [,2] [,3] [,4] [,5]
[1,]    1    2    3    4    5
[2,]    6    7    8    9   10

#関数 t() を利用します。
> t(example)
     [,1] [,2]
[1,]    1    6
[2,]    2    7
[3,]    3    8
[4,]    4    9
[5,]    5   10

> example<-matrix(1:10, nrow=2, ncol=5, byrow=F) 

> example
     [,1] [,2] [,3] [,4] [,5]
[1,]    1    3    5    7    9
[2,]    2    4    6    8   10

> t(example)
     [,1] [,2]
[1,]    1    2
[2,]    3    4
[3,]    5    6
[4,]    7    8
[5,]    9   10