On Thu, Nov 6, 2008 at 8:53 AM, dinesh kumar <barupal at gmail.com> wrote:
> Dear R users,
>
> I have a matrix like
>
> A X 1
> B Y 2
> C Z 3
>
> I want to reshape this matrix into this format
>
> X Y Z
> A 1
> B 2
> C 3
>
is this what you want?
> matrix(diag(c(1,2,3)),nrow=3,ncol=3,dimnames=list(c("A","B","C"),c("X","Y","Z")))
X Y Z
A 1 0 0
B 0 2 0
C 0 0 3