Re: [R] Question on creating list object

2008-11-17 Thread Stavros Macrakis
On Mon, Nov 17, 2008 at 5:00 AM, megh <[EMAIL PROTECTED]> wrote: >> lapply(1:5, function(i) c(1,2,3)^i) > [[1]] > [1] 1 2 3 ... > This is fine. However my goal is : each element of this list should depend > on previous element like : > > lis # List name > then, > > lis[[i]] = lis[[i-1]] + c(1,2,3)^

[R] Question on creating list object

2008-11-17 Thread megh
I get following result, while I write this code : > lapply(1:5, function(i) c(1,2,3)^i) [[1]] [1] 1 2 3 [[2]] [1] 1 4 9 [[3]] [1] 1 8 27 [[4]] [1] 1 16 81 [[5]] [1] 1 32 243 This is fine. However my goal is : each element of this list should depend on previous element like : lis # Lis