I am confused by the behavior of the below piece of code. The NAs are making it past the logical call ==0. I am sure that I am missing something. I just don't understand this behavior. Thanks for your help in advance.
########code####################################################### left <- (structure(list(measurment_num = c(2, 2.2, 2.4, 2.6, 2.8, 2.82, 3, NA, NA, NA), bankfull_depths_m = c(1.29, 1.28, 1.23, 0.18, -0.05, 0, -0.09, NA, NA, NA)), .Names = c("measurment_num", "bankfull_depths_m" ), row.names = c(10L, 11L, 12L, 13L, 14L, 20L, 15L, 16L, 17L, 18L), class = "data.frame")) if(sum(left[,"bankfull_depths_m"]==0, na.rm=TRUE) == 1){ left_min <- left[left[,"bankfull_depths_m"]==0, "measurment_num"] } left ################################################################## -- Stephen Sefick ____________________________________ | Auburn University | | Department of Biological Sciences | | 331 Funchess Hall | | Auburn, Alabama | | 36849 | |___________________________________| | sas0...@auburn.edu | | http://www.auburn.edu/~sas0025 | |___________________________________| Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis ______________________________________________ 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.