Skip to contents

Compare a subject ID vector to the study's reference subject ID (usually something like enrolres$subjid).

Usage

check_subjid(x, ref = getOption("edc_subjid_ref"))

Arguments

x

the subject ID column to check, or a dataframe which ID column will be guessed

ref

the reference for subject ID. Should usually be set through edc_options(edc_subjid_ref=xxx). See example.

Value

nothing, called for errors/warnings

Examples

tm = edc_example()
#> Warning: Option "edc_lookup" has been overwritten.
load_list(tm)
options(edc_subjid_ref=db0$SUBJID)
#usually, you set something like:
#options(edc_subjid_ref=enrolres$subjid)
check_subjid(db1)
#> Warning: `get_key_cols()` was deprecated in EDCimport 1.0.0.
#>  The deprecated feature was likely used in the EDCimport package.
#>   Please report the issue at <https://github.com/DanChaltiel/EDCimport/issues>.
db1 %>% dplyr::filter(SUBJID>1) %>% check_subjid()
#> Warning: Missing 1 subject ID in `.`: 1
check_subjid(c(db1$SUBJID, 99, 999))
#> Warning: Additional 2 subjects ID in `c(db1$SUBJID, 99, 999)`: 99 and 999