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.sh at 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 ? 11 [2,] ? ?8 ? 10 ? 12 ?I want to get a result something like dim1 ?dim2 ?dim3 ?elements 1 ? ? ? ?1 ? ? ? ?1 1 ? ? ? ?2 ? ? ? ?1 1 ? ? ? ?3 ? ? ? ? 2 2 ? ? ? ?1 ? ? ? ? 2 ?I tried the data.frame and expand.grid functions, but the results are not what i want. ?I ?think there must be an easy method to do it. Anybody can tell me that function or method? Thanks. ... -- ----------------- Jane Chang Queen's ? ? ? ?[[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Henrique Dallazuanna Curitiba-Paran?-Brasil 25? 25' 40" S 49? 16' 22" O