expect_equivalent() for categorical data #528
Comments
I would think that: expect_equivalent(c("Male", "Female"), c("Female", "Male")) should return TRUE but expect_equal(c("Male", "Female"), c("Female", "Male")) should return FALSE
Nicholas Horton |
Maybe I'm unlikely to implement this myself, but I'd be happy to review a PR. |
I know you are using base functions like
all.equal()
to do the underlying checks, but it would be nice to have a way to check levels in factor variables without getting the ordering precisely right. See https://github.com/dsscollection/factor-mgmt/blob/master/analysis/working_with_factors.Rnw#L394 for an example of what I'm talking about. In essence, I wish that I could runand get a TRUE.
Maybe this is something more appropriate for https://github.com/hadley/forcats ?
cc @nicholasjhorton
The text was updated successfully, but these errors were encountered: