问题 The following link if else statement gone bad suggests not to use the formulation > any( c(5,6,7) )==0 [1] FALSE I have been using any() to get rid of empty data frames in for() loops like this: id <- c(1,2,3,4,5,6) len <- c(11.25,11.75,12,12,12.5,13.25) df <- data.frame(id,len) bin.brks <- c(10,11,12,13,14) options(warn = -1) # to turn warnings off for (m in 1: (length(bin.brks)-1)){ #subset weights into each bin; empty when m=1 temp <- df[(df$len > bin.brks[m] & df$len <= bin.brks[m+1]),] #