Re: [R] reshape a matrix

2011-08-21 Thread Michael Dewey
At 18:21 20/08/2011, Uwe Ligges wrote: On 20.08.2011 19:04, David Winsemius wrote: On Aug 20, 2011, at 12:32 PM, Uwe Ligges wrote: [snip original problem] David, I think there are some good examples on the help page. What is missing? What is not clearly explained? If a longer tutorial

Re: [R] reshape a matrix

2011-08-21 Thread Uwe Ligges
On 21.08.2011 12:54, Michael Dewey wrote: At 18:21 20/08/2011, Uwe Ligges wrote: On 20.08.2011 19:04, David Winsemius wrote: On Aug 20, 2011, at 12:32 PM, Uwe Ligges wrote: [snip original problem] David, I think there are some good examples on the help page. What is missing? What is

[R] reshape a matrix

2011-08-20 Thread Wendy
Hi all, I have a data.frame like following A-c('d0','d0','d1','d1','d2','d2') B-rep(c('control','sample'),3) C-c(rep(10,2),200,300,400,500) dataframe-data.frame(A,B,C) I want to reshape the matrix, so the matrix with 'd0', 'd1' and 'd2' in rows and 'control' and 'sample' in columns. Is

Re: [R] reshape a matrix

2011-08-20 Thread Uwe Ligges
On 20.08.2011 17:04, Wendy wrote: Hi all, I have a data.frame like following A-c('d0','d0','d1','d1','d2','d2') B-rep(c('control','sample'),3) C-c(rep(10,2),200,300,400,500) dataframe-data.frame(A,B,C) I want to reshape the matrix, so the matrix with 'd0', 'd1' and 'd2' in rows and

Re: [R] reshape a matrix

2011-08-20 Thread David Winsemius
On Aug 20, 2011, at 12:32 PM, Uwe Ligges wrote: On 20.08.2011 17:04, Wendy wrote: Hi all, I have a data.frame like following A-c('d0','d0','d1','d1','d2','d2') B-rep(c('control','sample'),3) C-c(rep(10,2),200,300,400,500) dataframe-data.frame(A,B,C) I want to reshape the matrix, so the

Re: [R] reshape a matrix

2011-08-20 Thread Uwe Ligges
On 20.08.2011 19:04, David Winsemius wrote: On Aug 20, 2011, at 12:32 PM, Uwe Ligges wrote: On 20.08.2011 17:04, Wendy wrote: Hi all, I have a data.frame like following A-c('d0','d0','d1','d1','d2','d2') B-rep(c('control','sample'),3) C-c(rep(10,2),200,300,400,500)

Re: [R] reshape a matrix

2011-08-20 Thread David Winsemius
On Aug 20, 2011, at 1:21 PM, Uwe Ligges wrote: On 20.08.2011 19:04, David Winsemius wrote: On Aug 20, 2011, at 12:32 PM, Uwe Ligges wrote: On 20.08.2011 17:04, Wendy wrote: Hi all, I have a data.frame like following A-c('d0','d0','d1','d1','d2','d2') B-rep(c('control','sample'),3)

Re: [R] reshape a matrix

2011-08-20 Thread David Winsemius
On Aug 20, 2011, at 1:39 PM, David Winsemius wrote: On Aug 20, 2011, at 1:21 PM, Uwe Ligges wrote: On 20.08.2011 19:04, David Winsemius wrote: On Aug 20, 2011, at 12:32 PM, Uwe Ligges wrote: On 20.08.2011 17:04, Wendy wrote: Hi all, I have a data.frame like following

Re: [R] reshape a matrix

2011-08-20 Thread Rolf Turner
On 21/08/11 03:04, Wendy wrote: Hi all, I have a data.frame like following A-c('d0','d0','d1','d1','d2','d2') B-rep(c('control','sample'),3) C-c(rep(10,2),200,300,400,500) dataframe-data.frame(A,B,C) I want to reshape the matrix, so the matrix with 'd0', 'd1' and 'd2' in rows and

Re: [R] Reshape a matrix

2008-11-06 Thread ONKELINX, Thierry
: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens dinesh kumar Verzonden: donderdag 6 november 2008 1:53 Aan: r-help@r-project.org Onderwerp: [R] Reshape a matrix Dear R users, I have a matrix like A X1 B Y2 C Z3 I want to reshape this matrix into this format X

Re: [R] Reshape a matrix

2008-11-06 Thread Gabor Grothendieck
Assuming you mean data frame and not matrix and depending on whether the empty spaces are intended to represent NA or 0 we have: DF - data.frame(V1 = LETTERS[1:3], V2 = LETTERS[24:26], V3 = 1:3) tapply(DF[[3]], DF[1:2], c) V2 V1 X Y Z A 1 NA NA B NA 2 NA C NA NA 3 xtabs(V3 ~ V1

Re: [R] Reshape a matrix

2008-11-05 Thread cruz
On Thu, Nov 6, 2008 at 8:53 AM, dinesh kumar [EMAIL PROTECTED] wrote: Dear R users, I have a matrix like A X1 B Y2 C Z3 I want to reshape this matrix into this format X Y Z A 1 B 2 C 3 is this what you want?