nhanesSearch: Perform a search over the comprehensive NHANES variable list.

View source: R/nhanes_search.R

nhanesSearchR Documentation

Perform a search over the comprehensive NHANES variable list.

Description

The descriptions in the master variable list will be filtered by the provided search terms to retrieve a list of relevant variables. The search can be restricted to specific survey years by specifying ystart and/or ystop.

Usage

nhanesSearch(
  search_terms = NULL,
  exclude_terms = NULL,
  data_group = NULL,
  ignore.case = FALSE,
  ystart = NULL,
  ystop = NULL,
  includerdc = FALSE,
  nchar = 128,
  namesonly = FALSE
)

Arguments

search_terms

List of terms or keywords.

exclude_terms

List of exclusive terms or keywords.

data_group

Which data groups (e.g. DIET, EXAM, LAB) to search. Default is to search all groups.

ignore.case

Ignore case if TRUE. (Default=FALSE).

ystart

Four digit year of first survey included in search, where ystart >= 1999.

ystop

Four digit year of final survey included in search, where ystop >= ystart.

includerdc

If TRUE then RDC only tables are included in list (default=FALSE).

nchar

Truncates the variable description to a max length of nchar.

namesonly

If TRUE then only the table names are returned (default=FALSE).

Details

nhanesSearch is useful to obtain a comprehensive list of relevant tables. Search terms will be matched against the variable descriptions in the NHANES Comprehensive Variable Lists. Matching variables must have at least one of the search_terms and not have any exclude_terms. The search may be restricted to specific surveys using ystart and ystop. If no arguments are given, then nhanesSearch returns the complete variable list.

Value

Returns a data frame that describes variables that matched the search terms. If namesonly=TRUE, then a character vector of table names that contain matched variables is returned.

Examples

 bladder = nhanesSearch("bladder", ystart=2001, ystop=2008, nchar=50)
 dim(bladder)
 urin = nhanesSearch("urin", exclude_terms="During", ystart=2009)
 dim(urin)
 urine = nhanesSearch(c("urine", "urinary"), ignore.case=TRUE, ystop=2006, namesonly=TRUE)
 length(urine)

nhanesA documentation built on July 4, 2024, 9:08 a.m.