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

Plotting validator objects is sensitive to the ordering of the rules #184

Open
jsphdms opened this issue Aug 5, 2024 · 0 comments
Open

Comments

@jsphdms
Copy link

jsphdms commented Aug 5, 2024

Thank you for developing and maintaining this R package! It's been incredibly useful in my work as a Statistician for the Scottish Government.

Description

Plotting validator objects produces different (and sometimes incorrect) plots depending on the order of the rules. The smallest reproducible example I've been able to construct involves 3 rules.

Steps to Reproduce

library(validate)

rules_1 <- validator(
  r1 = a == shared_column,
  r2 = b == shared_column,
  r3 = c == another_column
)

rules_2 <- validator(
  r1 = a == shared_column,
  r3 = c == another_column,
  r2 = b == shared_column
)

plot(rules_1)
plot(rules_2)

image

image

Expected Behaviour

I'm assuming that the ordering of rules in a validator object does not change it's underlying properties, and therefore it's plot should not change. For example, I would expect that plot(rules_1) and plot(rules_2) would produce identical plots.

Actual Behaviour

When switching the order of r2 and r3, the plots change. It seems like the first plot is correct, but the second plot is incorrect.

R Environment

> sessionInfo()
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.utf8  LC_CTYPE=English_United Kingdom.utf8    LC_MONETARY=English_United Kingdom.utf8
[4] LC_NUMERIC=C                            LC_TIME=English_United Kingdom.utf8    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] tidyr_1.2.1      openxlsx_4.2.5.1 rlist_0.4.6.2    yaml_2.3.6       writexl_1.4.2    ggplot2_3.4.0    purrr_1.0.0     
 [8] validate_1.1.1   dplyr_1.0.10     readxl_1.4.1    

loaded via a namespace (and not attached):
 [1] zip_2.2.2         Rcpp_1.0.9        cellranger_1.1.0  pillar_1.8.1      compiler_4.2.2    tools_4.2.2       lifecycle_1.0.3  
 [8] tibble_3.1.8      gtable_0.3.1      pkgconfig_2.0.3   rlang_1.1.0       DBI_1.1.3         cli_3.5.0         rstudioapi_0.14  
[15] withr_2.5.0       generics_0.1.3    vctrs_0.5.2       grid_4.2.2        tidyselect_1.2.0  glue_1.6.2        data.table_1.14.6
[22] R6_2.5.1          fansi_1.0.3       magrittr_2.0.3    scales_1.2.1      settings_0.2.7    ellipsis_0.3.2    assertthat_0.2.1 
[29] colorspace_2.0-3  utf8_1.2.2        stringi_1.7.8     munsell_0.5.0
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