dot-has_instrument: Check if instrument in report df

.has_instrumentR Documentation

Check if instrument in report df

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

.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 Nov. 6, 2022, 3:54 a.m.