[R] reshape a matrix

Wendy wendy2.qiao at gmail.com
Sat Aug 20 17:04:37 CEST 2011


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(100000,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 there a function for doing this
easily?

Thank you in advance.

Wendy

--
View this message in context: http://r.789695.n4.nabble.com/reshape-a-matrix-tp3757179p3757179.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list