On Jun 21, 2010, at 7:18 PM, song song wrote:
May I ask how to initialize a list? usually I will use " result=list(0) " to do this. is this right?
There is now something in that list, namely an element whose value is zero. If you append to it with the c() function, the 0 will still be there.
> result=list(0) > result=c(result, 5) > result [[1]] [1] 0 [[2]] [1] 5 What's wrong with result=list() result=c(result, 5) > result [[1]] [1] 5 David Winsemius, MD West Hartford, CT ______________________________________________ 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.