[R] R's list data structure

Sarah Goslee sarah.goslee at gmail.com
Fri Feb 17 21:44:13 CET 2012


On Fri, Feb 17, 2012 at 3:37 PM, Ajay Askoolum <aa2e72e at yahoo.co.uk> wrote:
> Hi Sarah,
>
>             Thanks you for the clarifications; I had worked round the
> problem by switching to a data.frame.
>
>             However, I am still unclear about 'list': as it exists, it must
> have a purpose. When is the use of the list data structure appropriate?

I gave one example: storing lm() objects.

Here's another: I'm doing a lot of spatial processing, and I read a single
multispectral image into a list. Each list component is a SpatialGridDataFrame.
That way each band from a single image is part of the same R object, and
I can use lapply() to perform an operation on each band in turn.

Using lists for things is a very Rish way of working, but it may take a
while to get the hang of it.

-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list