R produces an unexpected result when attempting to subset a dataframe with the greater than >= operator.
Here are the results when using the == operator:
> head(sessions[sessions$datetime == "2016-06-25 13:29:43",],2)
id birdie datetime side_speed end_speed full_coverage
15 65 CALAN197 2016-06-25 13:29:43 -0.34 -0.34 1
However, when using the >= operator, the result that previously appeared in the previous operation no longer comes up.
> head(sessions[sessions$datetime >= "2016-06-25 13:29:43",],2)
id birdie datetime side_speed end_speed full_coverage
1 2 CALAN190 2016-06-30 08:54:40 -0.34 -0.34 1
2 3 CALAN190 2016-06-30 09:55:05 -0.34 0.00 1
In fact, this result is identical to the greater > operator.
How could this be?
Here is a minimal reproducible example:
d <- read.table(text = "1 | 2 | CALAN190 | 2016-06-30 08:54:40 | -0.34 | -0.34 | 1
2 | 3 | CALAN190 | 2016-06-30 09:55:05 | -0.34 | 0.00 | 1
15 | 65 | CALAN197 | 2016-06-25 13:29:43 | -0.34 | -0.34 | 1", sep = "|")
d$V4 <- as.POSIXct(d$V4)
head(d[d$V4 == "2016-06-25 13:29:43", ], 2)
head(d[d$V4 >= "2016-06-25 13:29:43", ], 2)