data-cleaning / errorlocate

Find and replace erroneous fields in data using validation rules
http://data-cleaning.github.io/errorlocate/
21 stars 3 forks source link

if (<var> == FALSE) ... handled incorrectly (<= 0.3 #23

Closed edwindj closed 4 years ago

edwindj commented 4 years ago

This is an edge case, which happens only when a logical variable is used with FALSE.

library(errorlocate)
rules <- validator(if (A == FALSE) x > 0)
data <- data.frame(A = FALSE, x = -1)

This should return an error (but it doesn't):

locate_errors(data, rules)$errors
##          A     x
## [1,] FALSE FALSE
edwindj commented 4 years ago

Fixed in >= 0.3

library(errorlocate)
rules <- validator(if (A == FALSE) x > 0)
data <- data.frame(A = FALSE, x = -1)

This should return an error:

locate_errors(data, rules)$errors
##          A    x
## [1,] FALSE TRUE