compare_ard() compares columns of two ARDs row-by-row using a shared set
of key columns. Rows where the column values differ are returned.
The is_ard_equal() function accepts a compare_ard()
object, and returns TRUE or FALSE depending on whether the comparison
reported difference. check_ard_equal() returns as error if not equal.
Usage
compare_ard(
x,
y,
keys = c(all_ard_groups(), all_ard_variables(), any_of(c("variable", "variable_level",
"stat_name"))),
columns = any_of(c("stat_label", "stat", "stat_fmt")),
tolerance = sqrt(.Machine$double.eps),
check.attributes = TRUE
)
is_ard_equal(x)
check_ard_equal(x)Arguments
- x
(
card)
first ARD to compare.- y
(
card)
second ARD to compare.- keys
(
tidy-select)
columns identifying unique records. The intersection of the selected columns in both ARDs is used. Default isc(all_ard_groups(), all_ard_variables(), any_of(c("variable", "variable_level", "stat_name"))).- columns
(
tidy-select)
columns to compare between the two ARDs. Default isany_of(c("stat_label", "stat", "stat_fmt")).- tolerance
(
numeric(1))
numeric tolerance passed toall.equal()for numeric comparisons. Default issqrt(.Machine$double.eps).- check.attributes
(
logical(1))
logical passed toall.equal()indicating whether object attributes (e.g. names) should be compared. Default isTRUE.
Value
a named list of class "ard_comparison" containing:
rows_in_x_not_y: data frame of rows present inxbut not iny(based on key columns)rows_in_y_not_x: data frame of rows present inybut not inx(based on key columns)compare: a named list where each element is a data frame containing the key columns, the compared column values from both ARDs, and adifferencecolumn with theall.equal()description for rows where values differ
Examples
base <- ard_summary(ADSL, by = ARM, variables = AGE)
compare <- ard_summary(dplyr::mutate(ADSL, AGE = AGE + 1),
by = ARM,
variables = AGE
)
compare_ard(base, compare)$compare$stat
#> NULL
