check_ids_match: Check ids

Description Usage Arguments Value Examples

View source: R/check-ids-match.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
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
)

Arguments

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 TRUE; if FALSE, will return only IDs in y that are not present in x (IDs in x but not y will be ignored).

Value

A condition object indicating whether IDs match ("check_pass") or not ("check_fail"). Mismatched IDs are included as data within the object.

Examples

1
2
3
4
5
6
7
8
9
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")
a <- data.frame(individualID = LETTERS[1:3])
b <- data.frame(individualID = LETTERS[1:4])
check_specimen_ids_match(a, b, "individual", "biospecimen")
a <- data.frame(specimenID = LETTERS[1:3])
b <- data.frame(specimenID = LETTERS[1:4])
check_specimen_ids_match(a, b, "biospecimen", "assay")

dccvalidator documentation built on July 2, 2020, 4:05 a.m.