Re: [R] Chopping a two column data frame by rows into a three dimensional array.

2012-10-15 Thread Jeff Newmiller
aperm(array(dat,c(10,10,2)),c(1,3,2)) --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: O

Re: [R] Chopping a two column data frame by rows into a three dimensional array.

2012-10-15 Thread arun
9  #[3,]  3  98  #[4,]  4  97  #[5,]  5  96  #[6,]  6  95  #[7,]  7  94  #[8,]  8  93  #[9,]  9  92 #[10,] 10  91 A.K. - Original Message - From: Hans Thompson To: r-help@r-project.org Cc: Sent: Monday, October 15, 2012 7:58 PM Subject: [R] Chopping a two column data frame by rows in

[R] Chopping a two column data frame by rows into a three dimensional array.

2012-10-15 Thread Hans Thompson
If I have a two column data frame like: > dat <- cbind("x"=c(1:100),"y"=c(100:1)) How can I create an array that splits every ten rows of that data frame into a third dimension of an array so that: > newarray[,,1] ,,1 x y 1 100 2 99 3 98 ... ... 10 91 ,,2 xy 11 90 12 89 ...