Re: [R] list subsetting

2009-06-29 Thread Tal Galili
how about ? for(i in 1:3) { b[[i]][[3]] <- 3 } or: for(i in 1:3) { b[[i]][[3]] <- a[[i]] } On Tue, Jun 30, 2009 at 6:54 AM, Ivo Shterev wrote: > > 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

Re: [R] List subsetting

2009-06-25 Thread Henrique Dallazuanna
Another options is: head(lapply(a, tail, 2), 2) On Wed, Jun 24, 2009 at 8:42 PM, Ivo Shterev wrote: > > 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)))

Re: [R] List subsetting

2009-06-25 Thread Dieter Menne
Ivo Shterev wrote: > > > I have a question about list indexing. Lets say we have a list of 3 lists, > each containing 3 different type elements: > > (Details of your nice example code removed) a=replicate(3, list(list(c(1,1,1), diag(3), c(2,2,2 str(a) # I prefer this to print(a) beca