for-loop ?
On Friday 06 December 2002 05:27 pm, Christian Schulz wrote:
...why the loop produce NA's ?
test[i] <- for (i in 1:30) {
+ healthy(i) + }
test
[1] 0 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA [26] NA NA NA NA 0
You probably want to do
test <- numeric(30)
for (i in 1:30) {
test[i] <- healthy(i)
}
-Deepayan