[R] List of lists ?

jim holtman jholtman at gmail.com
Mon Aug 9 19:19:20 CEST 2010


Is this what you want:

> x <- list()
> x[[1]] <- list(1:3)
> x[[2]] <- list(3:1)
> x
[[1]]
[[1]][[1]]
[1] 1 2 3


[[2]]
[[2]][[1]]
[1] 3 2 1



On Mon, Aug 9, 2010 at 12:57 PM, Carlos Petti <carlos.petti at gmail.com> wrote:
> Dear list,
>
> I have to use a list of lists containing vectors.
>
> For instance :
>
> [[1]]
> [[1]][[1]]
> [1] 1 2 3
>
> [[1]][[2]]
> [1] 3 2 1
>
> I want to attribute vectors to the main list
>
> without use of an intermediate list,
>
> but it does not work :
>
> x <- list()
> x[[1]][[1]] <- c(1, 2, 3)
> x[[1]][[2]] <- c(3, 2, 1)
>
> Thanks in advance,
> Carlos
>
> ______________________________________________
> R-help at 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.
>



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

What is the problem that you are trying to solve?



More information about the R-help mailing list