On Thu, Nov 6, 2008 at 8:53 AM, dinesh kumar <[EMAIL PROTECTED]> 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 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.