Hello, I have a question about list indexing. Lets say we have a list of 3 lists, each containing 3 different type elements:
> a=replicate(3, list(list(c(1,1,1), diag(3), c(2,2,2)))) > a [[1]] [[1]][[1]] [1] 1 1 1 [[1]][[2]] [,1] [,2] [,3] [1,] 1 0 0 [2,] 0 1 0 [3,] 0 0 1 [[1]][[3]] [1] 2 2 2 [[2]] [[2]][[1]] [1] 1 1 1 [[2]][[2]] [,1] [,2] [,3] [1,] 1 0 0 [2,] 0 1 0 [3,] 0 0 1 [[2]][[3]] [1] 2 2 2 [[3]] [[3]][[1]] [1] 1 1 1 [[3]][[2]] [,1] [,2] [,3] [1,] 1 0 0 [2,] 0 1 0 [3,] 0 0 1 [[3]][[3]] [1] 2 2 2 If anyone can point a direction as to how to obtain (subset) the following list from list a: > b [[1]] [[1]][[1]] [,1] [,2] [,3] [1,] 1 0 0 [2,] 0 1 0 [3,] 0 0 1 [[1]][[2]] [1] 2 2 2 [[2]] [[2]][[1]] [,1] [,2] [,3] [1,] 1 0 0 [2,] 0 1 0 [3,] 0 0 1 [[2]][[2]] [1] 2 2 2 Also, suppose that one wishes to assign the list "b" to the corresponding subset of list "a". Is there a way of doing so? Thanks for the help. Ivo ______________________________________________ R-help@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.