Re: [R] Finicky factor comparison operators

2012-02-20 Thread David Winsemius
On Feb 20, 2012, at 1:45 AM, johnmark wrote: MIchael - Thanks for your insight. I think I see where you're going with this. To make '==' comparisons for subsetting against an ordered factor, I've had to create a lookup table for all possible values I'd ever want to compare against (all d

Re: [R] Finicky factor comparison operators

2012-02-20 Thread johnmark
MIchael - Thanks for your insight. I think I see where you're going with this. To make '==' comparisons for subsetting against an ordered factor, I've had to create a lookup table for all possible values I'd ever want to compare against (all dates covered by the quarters in question, in this c

Re: [R] Finicky factor comparison operators

2012-02-18 Thread R. Michael Weylandt
It's not a matter of unordered & ordered factors, but ordered factors and Dates (as the warning says) I can see at least one ambiguity -- should comparison be made from the level or the internal code -- so the warning makes sense to me (though an error might make even more sense). Generally, for f

[R] Finicky factor comparison operators

2012-02-18 Thread johnmark
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"