Hi R users:

f1<-function(l1,idx){
  f2<-function(i,l1)   l1[[i+1]]<<-c(l1[[i]],l1[[i+1]][-1])
  lapply(idx,f2,l1)
  return(l1)
}

l<-list(c(1,2,3),c(4,5),c(6,7,8))

l2<-f1(l,1:(length(l)-1))

l2

I got:

[[1]]
[1] 1 2 3

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

[[3]]
[1] 4 5 7 8

But what I want in the last position of l2 is the acummualte of the
assignations...

I would like to have:

[[1]]
 [1] 1 2 3
 
 [[2]]
 [1] 1 2 3 5
 
 [[3]]
 [1] 1 2 3 5 7 8
 
How can I do that?

Thank you for your help.

Kenneth



	[[alternative HTML version deleted]]


