Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing data columns where not handled correctly (<= 0.3) #22

Closed
edwindj opened this issue Feb 12, 2020 · 2 comments
Closed

Missing data columns where not handled correctly (<= 0.3) #22

edwindj opened this issue Feb 12, 2020 · 2 comments

Comments

@edwindj
Copy link
Member

edwindj commented Feb 12, 2020

If we supply a dataset missing a column/variable which is mentioned in the rules set. It just ignored the variable or gave strange errors.

library(errorlocate)
rules <- validator(x > 0, y > 0)
# loading data without y!
data <- data.frame(x = 1)
le <- locate_errors(data, rules)
le$errors
##          x
## [1,] FALSE
rules <- validator(x > y, y > 0, z > 0)
data <- data.frame(x = 0, y = 1)
le <- locate_errors(data, rules)
le$errors
##         x  y
## [1,] TRUE NA
@edwindj
Copy link
Member Author

edwindj commented Feb 12, 2020

Fixed in version 0.3.2,
Automatically a column is added to the dataset with NA and a warning is generated.

library(errorlocate)
rules <- validator(x > 0, y > 0)
data <- data.frame(x = 1)
le <- locate_errors(data, rules)
## Warning: Adding missing columns 'y'=NA to data.frame.
le$errors
##          x  y
## [1,] FALSE NA
rules <- validator(x > y, y > 0, z > 0)
data <- data.frame(x = 0, y = 1)
le <- locate_errors(data, rules)
## Warning: Adding missing columns 'z'=NA to data.frame.
le$errors
##         x     y  z
## [1,] TRUE FALSE NA

edwindj added a commit that referenced this issue Feb 12, 2020
@edwindj
Copy link
Member Author

edwindj commented Feb 18, 2020

Choose a different solution: missing a data column now gives an error. (>=0.3.3)

@edwindj edwindj closed this as completed Feb 18, 2020
edwindj added a commit that referenced this issue Feb 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant