Giter Club home page Giter Club logo

Comments (3)

yjunechoe avatar yjunechoe commented on June 3, 2024 2

I think that's consistent with the expectation for col_vals_equal() to use == for checking equality - the following is not TRUE:

NA == NA
#> [1] NA

With regards to na_pass, that's a general argument for whether NA results from the validation operations should count as a pass. As far as col_vals_equal() is concerned, NA == NA and NA == 1 are both NA - the na_pass argument is not aware of how you got to the NA value with ==. So the fact that both rows involving NA values pass in your second example with na_pass = TRUE is again the intended/documented behavior.

For a workaround, you can either recode the NAs into some value that's legible to == in the preconditions argument, as you mention, or use col_vals_expr() instead and be more explicit about the looser criteria for equality. That latter approach can get a bit more verbose, but either of the following lets you match two NAs as a match but an NA with some other value as a mismatch:

col_vals_expr(
  expr = expr(Vectorize(identical)(a, b))
)
col_vals_expr(
  expr = expr(!xor(is.na(a), is.na(b)) & a == b)
)

from pointblank.

vhh711 avatar vhh711 commented on June 3, 2024 2

Thanks so much for this explanation! I appreciate it.

I'll give the preconditions argument and the col_vals_expr() options a try.

from pointblank.

rich-iannone avatar rich-iannone commented on June 3, 2024 1

@yjunechoe thank you for the explanation :) and I think we can close this one.

from pointblank.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.