On Mon, Jan 5, 2009 at 6:30 AM, <mau...@alice.it> wrote: > My question is motivated by dealing with pairs of values, like (3,12.5), > (16,2.98), and so on > that are mapped to a cartesian plain (Time, Frequence) > I miss C multidimensional arrays. I am trying to simulate the 3rd dimension > by declaring a matrix of lists.
I think the standard R way to do this would be with a 3-dimensional array. Many functions are designed to work well with n-dimensional arrays, including apply and the plyr package. But R does allow you to make a matrix of lists. >> A <- matrix(data ="list", nrow=2, ncol=4) This creates a matrix of strings (character vector). What you want is a matrix of lists, something like this: A<-matrix(data=list(), nrow=2,ncol=4) Then I think all your examples below work. -s PS Note that it does *not* work to write data=NULL, because NULL is not of class/mode 'list', even though the resulting matrix is filled with NULL. ______________________________________________ R-help@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.