Skip to contents

stop with a clear, actionable error message if any of `cols` is missing from `dat_raw_anon`, instead of letting the caller fail downstream with a confusing low-level error (e.g. base R's "replacement has 0 rows, data has NNN" from indexing a non-existent column with `[[`, which gives no hint about which column name was actually wrong).

Usage

check_raw_anon_columns_exist(dat_raw_anon, cols, fn_name)

Arguments

dat_raw_anon

dataframe of raw_anon form

cols

character vector of (already RAW_/ANON_-prefixed) column names that the caller is about to look up in `dat_raw_anon`

fn_name

name of the calling score_*() function, used in the error message

Value

invisible NULL if all `cols` are present; otherwise stops with an error naming the missing column(s).