[R] Change an array into a dataset of four variables, dim1, dim2, dim3 and its elements
Hi, See my example below. a-array(1:12,c(2,3,2)) a , , 1 [,1] [,2] [,3] [1,]135 [2,]246 , , 2 [,1] [,2] [,3] [1,]79 11 [2,]8 10 12 I want to get a result something like dim1 dim2 dim3 elements 111 121 1
Re: [R] Change an array into a dataset of four variables, dim1, dim2, dim3 and its elements
Try this: sapply(as.data.frame.table(a), as.numeric) On Wed, Jan 20, 2010 at 3:18 PM, rusers.sh rusers...@gmail.com wrote: Hi, See my example below. a-array(1:12,c(2,3,2)) a , , 1 [,1] [,2] [,3] [1,] 1 3 5 [2,] 2 4 6 , , 2 [,1] [,2] [,3] [1,] 7 9