Re: [R] arrays of lists in R ("cell arrays" in Matlab)

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Thu 16 Feb 2006 - 07:10:32 EST

Try this:

L <- list(sqrt, letters, pi, 1:4)
dim(L) <- c(2,2)
L[[1,1]](4) # 2

On 2/15/06, Giuseppe Pagnoni <gpagnon@emory.edu> wrote:
> Dear all
>
> I would like to have some data in the form of a 2-dimensional array
> (matrix) of lists, so that I can easily find the desired list object by
> indexing the structure by rows and columns. In matlab there exists a
> data type called "cell array": a matrix of "cells", which are composite
> objects very similar to R lists.
>
> I know that in R you can create 1-dimensional arrays of lists, either
> with the vector() function or by making a list of lists, but it is not
> clear to me whether it is actually possible to have 2-dimensional arrays
> of lists.

>
> thank you very much for any suggestion
>
> best
>
> giuseppe
>
> --
> -----
> Giuseppe Pagnoni
> Psychiatry and Behavioral Sciences
> Emory University School of Medicine
> 101 Woodruff Circle, Suite 4000
> Atlanta, GA, 30322
> tel: 404.712.8431
> fax: 404.727.3233
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Feb 16 07:13:39 2006

This archive was generated by hypermail 2.1.8 : Thu 16 Feb 2006 - 16:33:35 EST