term_search: Search NHANES Variables by Term or Phrase

View source: R/data.R

term_searchR Documentation

Description

A convenience wrapper around nhanesA::nhanesSearch that returns a simplified, concise output focused on variable names, descriptions, and survey years. Results are sorted by year (most recent first) and then by variable name.

Usage

term_search(var)

Arguments

var

Character. Search term or phrase to find in variable names or descriptions. Case-insensitive. Special regex characters are automatically escaped for literal matching.

Value

A data.frame with 4 columns:

  • Variable.Name: NHANES variable code

  • Variable.Description: Description of the variable

  • Data.File.Name: Name of the data file containing the variable

  • Begin.Year: Starting year of the survey cycle (numeric)

Results are sorted by Begin.Year (descending) then Variable.Name. Returns an empty data.frame with correct structure if no matches found.

See Also

var_search for searching by exact variable name, get_url for getting documentation URLs, nhanesSearch for the underlying search function

Other search and lookup functions: get_url(), var_search()

Examples


# Search for diabetes-related variables (showing first 5 results)
term_search("diabetes") |> head(5)

# Search for blood pressure measurements (showing first 5 results)
term_search("blood pressure") |> head(5)



nhanesdata documentation built on March 1, 2026, 1:06 a.m.