[R] list subsetting

Ivo Shterev idc318 at yahoo.com
Tue Jun 30 05:54:42 CEST 2009


Dear All,

I am interested to know how assign a list to a list of lists. For example how to assign the list a = list(3,3,3) to the list b:

> b
[[1]]
[[1]][[1]]
[1] 0

[[1]][[2]]
[1] 0

[[1]][[3]]
[1] 0


[[2]]
[[2]][[1]]
[1] 0

[[2]][[2]]
[1] 0

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


[[3]]
[[3]][[1]]
[1] 0

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

[[3]][[3]]
[1] 0

so that after the assignment

> b
[[1]]
[[1]][[1]]
[1] 0

[[1]][[2]]
[1] 0

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


[[2]]
[[2]][[1]]
[1] 0

[[2]][[2]]
[1] 0

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


[[3]]
[[3]][[1]]
[1] 0

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

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

Thanks a lot!
Ivo




More information about the R-help mailing list