Conversation
…overlapping key values, enabling mismatches to surface through the full join comparison.
move all helper functions to compare_are_helpers
| #' (based on key columns) | ||
| #' - `rows_in_y_not_x`: data frame of rows present in `y` but not in `x` | ||
| #' (based on key columns) | ||
| #' - `compare`: a named list where each element is a data frame containing |
There was a problem hiding this comment.
Do you mean rename the "compare" to "diff"? That's fine with me yes.
| #' | ||
| #' compare_ard(ard_base, ard_modified)$compare$stat | ||
| #' | ||
| compare_ard <- function(x, |
There was a problem hiding this comment.
I really like the construction and concept of the main function. The helper functions are a bit of a Dedalus but I will take a closer look during the week ;)
There was a problem hiding this comment.
Sure! And I learnt a new word here :)
R/compare_ard.R
Outdated
| #' @examples | ||
| #' ard_base <- ard_summary(ADSL, variables = AGE) | ||
| #' ard_modified <- ard_summary(dplyr::mutate(ADSL, AGE = AGE + 1), variables = AGE) | ||
| #' | ||
| #' compare_ard(ard_base, ard_modified)$compare$stat |
There was a problem hiding this comment.
maybe I would make the more examples more complex (so to show groups etc)
There was a problem hiding this comment.
I'll add some more complex ones.
R/compare_ard_helpers.R
Outdated
| # perform inner join to compare only matching rows | ||
| comparison <- dplyr::inner_join( | ||
| x_selected, | ||
| y_selected, | ||
| by = keys, | ||
| suffix = c(".x", ".y") | ||
| ) |
There was a problem hiding this comment.
for some reason this does not drop the "card" class producing a contracted output (not showing some columns). Should we keep this behavior or should we drop the card class? maybe defining card_diff new class?
$stat
{cards} data frame: 6 x 4
variable stat_name
1 AGE mean
2 AGE median
3 AGE p25
4 AGE p75
5 AGE min
6 AGE max
ℹ 2 more variables: stat.x, stat.y
There was a problem hiding this comment.
Good point, I accepted the below suggestion
Melkiades
left a comment
There was a problem hiding this comment.
Amazing work!! I really like it, output is very intuitive and efficient in showing differences. I added a minor comment on the final compare output that is hiding columns and I would add more examples but for me the code is almost complete. I was wondering if we could need a +- diff like testthat snapshots as an optional diff output... Dont know, for now it is pretty easy to understand the output.
I still need to test this with more complex differences (e.g. I wonder if you solve the fmt before getting into the comparison or not - we should if not), but I wait to try the additional examples ;)
Co-authored-by: Davide Garolini <dgarolini@gmail.com> Signed-off-by: Malan <64360731+malanbos@users.noreply.github.com>
Co-authored-by: Davide Garolini <dgarolini@gmail.com> Signed-off-by: Malan <64360731+malanbos@users.noreply.github.com>
Co-authored-by: Davide Garolini <dgarolini@gmail.com> Signed-off-by: Malan <64360731+malanbos@users.noreply.github.com>
| matches <- mapply( | ||
| identical, |
There was a problem hiding this comment.
as discussed -> all.equals
…ibutes Replaces identical() with all.equal() for element-wise value comparison, exposing tolerance and check.attributes parameters. Mismatch data frames now include a difference column with all.equal() descriptions. Example updated to use by = ARM grouping. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
As discussed 9Feb, made two updates:
|
What changes are proposed in this pull request?
New function to compare two ARDs: ard_compare
Fixes#437 , @malanbos
Comes with top-level ard_compare function, as well as a script with ard_compare_helpers.R, and check_environment.R to modularize it.
Pre-review Checklist (if item does not apply, mark is as complete)
usethis::pr_merge_main()devtools::test_coverage()Reviewer Checklist (if item does not apply, mark is as complete)
pkgdown::build_site(). Check the R console for errors, and review the rendered website.devtools::test_coverage()When the branch is ready to be merged:
NEWS.mdwith the changes from this pull request under the heading "# cards (development version)". If there is an issue associated with the pull request, reference it in parentheses at the end update (seeNEWS.mdfor examples).Optional Reverse Dependency Checks:
Install
checkedwithpak::pak("Genentech/checked")orpak::pak("checked")