dot-has_instrument: Check if instrument in report df

Description Usage Arguments Value

Description

Given a character vector of instrument prefixes (typically non-repeating instruments like demo and med), return whether a variable from those instruments is included. This is equivalent to something like grepl(colnames(inst), "^demo_") but will return as soon as it finds one. So, best case O(3) worst case O(n)

Usage

1
.has_instrument(inst, check_prefixes, USE.NAMES = FALSE)

Arguments

inst

Dataframe of a single instrument, this will typically be the output of filtering the report where redcap_repeating_instrument is NA

check_prefixes

Which prefixes to check, typically c('demo','med')

USE.NAMES

Whether to return prefixes as names in the logical vector, defaults to FALSE

Value

Logical vector, TRUE if prefix is found in the colnames of the instrument df, FALSE if not


tsostarics/anrlab documentation built on Dec. 13, 2021, 10:11 a.m.