[R-sig-Geo] Convert array to list

Edzer Pebesma edzer.pebesma at uni-muenster.de
Sun Oct 17 00:00:58 CEST 2010


a = array(1:27, c(3,3,3))
a
unlist(lapply(apply(a,1,function(x) apply(x,1,list)),
  function(x) unlist(x, recursive = FALSE)), recursive = FALSE)


On 10/16/2010 11:15 PM, kapo coulibaly wrote:
> Is there a quick way to convert a 3 dimensional array to a list of vectors
> of the third dimension. ex:
> array[a,b,c] to a list containing array[1,1,], array[1,2,],
> array[1,3].........array[1,b], array[2,1,] ......array[a,b,c]
> 
> preferably avoiding l;oops.
> 
> Thanks
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics      e.pebesma at wwu.de



More information about the R-sig-Geo mailing list