Re: [R] Converting array to matrix

2012-09-29 Thread arun
HI, Try this: source("arrayconvert.txt")  #dat2 is the data frame dat4<-split(dat2,dat2$p) res1<-do.call(rbind,lapply(lapply(lapply(dat4,`[`,5),function(x) matrix(x,dim=list(20,1))),unlist))  dim(res1) #[1] 50 20 head(res1,3) #  [,1]  [,2]  [,3]  [,4]  [,5]  [,6] 

Re: [R] Converting array to matrix

2012-09-28 Thread David Winsemius
On Sep 28, 2012, at 3:59 PM, farnoosh sheikhi wrote: > Hi, > > I have a 3d array as below, I want to make this array to a matrix of > p=50(rows) and n=20(columns) with the coverage values . > The code before the array is: ?matrix mat <- matrix(datfrm$coverage, 50, 20) filled.contour(mat) # u