How about like this: for (i in seq_along(a)) { result <- as.list(a[1:i]) cat("iterator", i, ":\n") print(result) }
On Sat, Jul 25, 2009 at 6:48 AM, Alberto Lora M<albertolo...@gmail.com> wrote: > Hi Everybody > > I have the following problem > > suppose that we > > a<-c("uno","dos","tres") > > I am working with a while cycle and the idea is in each iteration adding an > item to a list > > In the first iteration the resultshould be: > [[1]] > [1] "uno" > > In the second > [[1]] > [1] "uno" > [[2]] > [1] "dos" > > And the final result > [[1]] > [1] "uno" > [[2]] > [1] "dos" > [[3]] > [1] "tres" > > How can I do that > Thx again > -- > Alberto > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. > ______________________________________________ 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.