"If you showed the output of dput(yourData) or even str(yourData) others could see what types the columns are. Ordinary printed output can make numeric, character, and factor data look the same. Comparisons involving strings do not always return the same value as comparisons involving the equivalent numbers. E.g.,
> y <- c("0.00", "0.01", "10.1", "20.2", "0.00") > z <- zoo(y, as.POSIXct("2012-03-14")+(1:5)*24*60*60) > z # looks like numeric data, but it is not 2012-03-15 2012-03-16 2012-03-17 2012-03-18 2012-03-19 0.00 0.01 10.1 20.2 0.00 > str(z) 'zoo' series from 2012-03-15 to 2012-03-19 Data: chr [1:5] "0.00" "0.01" "10.1" "20.2" "0.00" Index: POSIXct[1:5], format: "2012-03-15" "2012-03-16" "2012-03-17" "2012-03-18" "2012-03-19" > z[z>0] 2012-03-15 2012-03-16 2012-03-17 2012-03-18 2012-03-19 0.00 0.01 10.1 20.2 0.00 > z[z>"0.00"] 2012-03-16 2012-03-17 2012-03-18 0.01 10.1 20.2 > "0.0" > 0 [1] TRUE " Ah I see. So it's seeing the ASCII values I'm assuming. Yeah, I think this was the case I was running into. It seems it's just dependent on the raw data because recently when I was reading in raw data as zoo, this didn't happen. However, my dput results show quoted values, technically strings. Thank you for pointing this out. I'll remember to use dput next time. Noob mistake. Won't happen again. -- View this message in context: http://r.789695.n4.nabble.com/logical-test-not-functioning-correctly-on-zoo-series-what-the-hell-tp4471654p4473057.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.