You can use t(); it returns the transpose of a matrix.
Here is an example:
a <- c(10,15,20,12,16,18,17)
b <- c(12,14,23,10,13,19,18)
m <- matrix(c(a,b), nc=2)
m1 <- t(m)
The above code will return the following output (Matrix 'm' and its transpose 'm1'):
> m
[,1] [,2]
[1,] 10 12
[2,] 15 14
[3,] 20 23
[4,] 12 10
[5,] 16 13
[6,] 18 19
[7,] 17 18
> m1
[,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,] 10 15 20 12 16 18 17
[2,] 12 14 23 10 13 19 18
>