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

correct_typos does not work with var_group rule (validator) #3

Closed
edwindj opened this issue Mar 28, 2024 · 1 comment · Fixed by #4
Closed

correct_typos does not work with var_group rule (validator) #3

edwindj opened this issue Mar 28, 2024 · 1 comment · Fixed by #4

Comments

@edwindj
Copy link
Member

edwindj commented Mar 28, 2024

The following does not work (version 1.0.1)

library(deductive)
## correct_typos should expand var_group
v <- validator(
  pos := var_group(x),
  pos = pos > 0,
  lin = x + y == 20
)

dat <- data.frame( x = 21, y = 8)
tinytest::expect_equivalent( data.frame(x = 12,y = 8)
                           , correct_typos(dat, v)
                           )

Thanks to @reijeridema for reporting!

The issue is similar to #2 , but probably has implications for validate.
The method <validator>$linear_coefficients() does not allow for expanding groups and assignments, but it should (by default IMHO).

@reijeridema
Copy link
Collaborator

On further investigation the problem seems to be in the expansion of the assigment rule pos := var_group(x).

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

Successfully merging a pull request may close this issue.

2 participants