[R] Finicky factor comparison operators

johnmark johnmark.agosta at gmail.com
Sat Feb 18 21:08:14 CET 2012

 This error occurs because the "==" comparison operator doesn't allow
comparison of ordered and normal factors:

/df[df5$close_quarter == as.Date("2011-02-01"),]/
Warning message:
In /`[.data.frame`(df, df$close_quarter == as.Date("2011-02-01")/,  :
  Incompatible methods ("Ops.ordered", "Ops.Date") for "=="

Why should this be a problem -- Isn't this being overly cautious?  Can
anyone think of a case where coercing the ordered factor to a normal factor
for comparisons of == would do the wrong thing? 

Perhaps this is a question for the developer's section. 

Cheers -john mark agosta

View this message in context: http://r.789695.n4.nabble.com/Finicky-factor-comparison-operators-tp4400377p4400377.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list