for (i in 2:nrow(fox)) {
temp = fox[i,c(7:18)]
check = (temp==0)
if(all(check))
new <- fox[-c(i),]
else
print('okay')
}
I'm writing this block of R code to basically delete a row from the dataframe 'fox' if all the columns are 0. It seems to be working except for the fact the 'new' dataframe just is short of the first row, but has to omit many rows too. Any idea what could the error and how to rectify it.