assert_terms: Asserts Requirements for Terms for Queries

View source: R/create_query_data.R

assert_termsR Documentation

Asserts Requirements for Terms for Queries

Description

The function checks the requirements for terms for queries provided by the user. The terms could have been provided directly in the query definition or via a user provided function for accessing a SMQ or SDG database.

Usage

assert_terms(terms, expect_grpname = FALSE, expect_grpid = FALSE, source_text)

Arguments

terms

Terms provided by user

expect_grpname

Is the GRPNAME column expected?

expect_grpid

Is the GRPID column expected?

source_text

Text describing the source of the terms, e.g., ⁠"the data frame provided for the ⁠definition⁠ element"⁠.

Value

An error is issued if

  • terms is not a data frame,

  • terms has zero observations,

  • the SRCVAR variable is not in terms,

  • neither the TERMCHAR nor the TERMNUM variable is in terms,

  • expect_grpname == TRUE and the GRPNAME variable is not in terms,

  • expect_grpid == TRUE and the GRPID variable is not in terms,

Examples


try(
  assert_terms(
    terms = 42,
    source_text = "object provided by the `definition` element"
  )
)


admiral documentation built on May 28, 2026, 9:08 a.m.