var_search: Search for NHANES Variable by Exact Name

View source: R/data.R

var_searchR Documentation

Description

A convenience wrapper around nhanesA::nhanesSearchVarName that searches for variables by exact variable name match. The function automatically converts input to uppercase to match NHANES naming conventions. Use this when you know the variable code; use term_search() for text-based searches.

Usage

var_search(var)

Arguments

var

Character. Variable name to search for. Will be automatically converted to uppercase. Not case-sensitive.

Value

A character vector of CDC table names containing the variable (e.g., "DEMO", "DEMO_B", "DEMO_C"). Returns character(0) if the variable is not found.

See Also

term_search for text-based searches, get_url for documentation URLs, nhanesSearchVarName for the underlying function

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

Examples


# Search for specific variable (case-insensitive)
var_search("RIDAGEYR") # Age variable across all DEMO cycles
var_search("BPXSY1") # Systolic blood pressure



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