After quite a bit of debugging today, to my dismay i found that:
for (i in 1:0) {
print(i)
}
Actually prints 1 and 0 respectively in R. The problem came up when writing
for (i in 1:nrow(myframe) {
fn(i)
}
Which i had intended to not execute at all if nrow(myframe)==0. Is the proper correction just:
if (nrow(myvect) != 0) {
for (i in 1:nrow(myframe) {
fn(i)
}
}
Or is there a more proper way to do what I wanted in R?