Compare IDs (such as individual IDs or specimen IDs) between two data frames.
Ensure that all individual IDs in two data frames match.
Ensure that all specimen IDS in two data frames match
check_ids_match( x, y, idcol = c("individualID", "specimenID"), xname = NULL, yname = NULL, bidirectional = TRUE ) check_indiv_ids_match(x, y, xname = NULL, yname = NULL, bidirectional = TRUE) check_specimen_ids_match( x, y, xname = NULL, yname = NULL, bidirectional = TRUE )
x, y | Data frames to compare |
---|---|
idcol | Name of column containing ids to compare |
xname, yname | Names of x and y (to be used in resulting messages) |
bidirectional | Should mismatches from both x and y be reported?
Defaults to |
A condition object indicating whether IDs match ("check_pass"
) or
not ("check_fail"
). Mismatched IDs are included as data within the
object.
a <- data.frame(individualID = LETTERS[1:3]) b <- data.frame(individualID = LETTERS[1:4]) check_ids_match(a, b, idcol = "individualID", xname = "a", yname = "b")#> <error/check_fail> #> individualID values are mismatched between a and ba <- data.frame(individualID = LETTERS[1:3]) b <- data.frame(individualID = LETTERS[1:4]) check_specimen_ids_match(a, b, "individual", "biospecimen")#> <error/check_fail> #> Missing column specimenID in individual or biospecimen metadataa <- data.frame(specimenID = LETTERS[1:3]) b <- data.frame(specimenID = LETTERS[1:4]) check_specimen_ids_match(a, b, "biospecimen", "assay")#> <error/check_fail> #> specimenID values are mismatched between biospecimen and assay