On Sep 11, 2010, at 8:39 AM, Peng, C wrote:
or: k=0 for (i in 1:k) if(k>0) print(i)
Because of the way the ":" operator works, I would have tested k >=1 > k=0.5 > for (i in 1:k) if (k>0){print(i)} [1] 1 But Gabor's suggestion to use seq_len(k) is cleaner, anyway. -- 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.