# Re: [R] Dimensions of a List

From: jim holtman <jholtman_at_gmail.com>
Date: Tue, 25 Mar 2008 10:51:06 -0500

Is this what you want?

> l=list(list(c(1,2),c(4,5),c(6,7)),list(c(11,22,33),c(44,55,66)))
> str(l)

List of 2
\$ :List of 3

```  ..\$ : num [1:2] 1 2
..\$ : num [1:2] 4 5
..\$ : num [1:2] 6 7
```

\$ :List of 2
..\$ : num [1:3] 11 22 33
..\$ : num [1:3] 44 55 66
>

On 3/25/08, Shubha Vishwanath Karanth <shubhak_at_ambaresearch.com> wrote:
> Hi R,
>
>
>
> I have a list,
>
>
>
> l=list(list(c(1,2),c(4,5),c(6,7)),list(c(11,22,33),c(44,55,66)))
>
>
>
> > l
>
> [[1]]
>
> [[1]][[1]]
>
> [1] 1 2
>
>
>
> [[1]][[2]]
>
> [1] 4 5
>
>
>
> [[1]][[3]]
>
> [1] 6 7
>
>
>
>
>
> [[2]]
>
> [[2]][[1]]
>
> [1] 11 22 33
>
>
>
> [[2]][[2]]
>
> [1] 44 55 66
>
>
>
>
>
> How do I know the dimensions of this list?... In other words, how many
> sub-lists, sub-sub-lists etc...are there in l? How do I know this?
>
>
>
>
> Shubha
>
> This e-mail may contain confidential and/or privileged i...{{dropped:13}}
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> and provide commented, minimal, self-contained, reproducible code.
>

```--
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help