findVars: Find variables

View source: R/findvars.r

findVarsR Documentation

Find variables

Description

Provide a list of search terms to find variables in the data dictionary.

Usage

findVars(
  ...,
  logic = "any",
  ignore.case = TRUE,
  perl = FALSE,
  fixed = FALSE,
  whole.word = FALSE,
  dictionary = "both"
)

Arguments

...

Search terms

logic

Conditions for the search strings, can be "all", "any", or "none". Set to "any" by default.

ignore.case

Should search terms be case sensitive? Defaults to TRUE.

perl

logical. Should perl-compatible regexps be used? Defaults to FALSE.

fixed

logical. If 'TRUE', 'pattern' is a string to be matched as is. Overrides all conflicting arguments. Defaults to FALSE.

whole.word

If 'TRUE' search term "word" will be changed to "\bword\b" to only match whole words. Defaults to FALSE.

dictionary

Data frame or name of a data dictionary. Dictionaries available by default are "current" (from the R:/Data/Current folder), "useful" (from the R:/Data/Useful_data folder) and "both" (combined "current" and "useful"). New dictionaries can be created using the createDictionary() function. (Default: "both").

Details

The resulting data frame will have the following columns:

  • obj - The name of the data file

  • name - The name of the variable

  • type - The type of data for the variable

  • lab - A description of the label

  • code - The ALSPAC dictionary code for the variable

  • counts - The number of non-NA values in the variable

  • cat1-4 - These columns correspond to the folder names that the objects were found in

Value

A data frame containing a list of the variables, the files they originate from, and some descripton about the files

Examples

## Not run: 
# Find variables with BMI or height in the description (this will return a lot of results!)
bmi_variables <- findVars("bmi", "height", logic="any", ignore.case=TRUE)

## End(Not run)

explodecomputer/alspac documentation built on Feb. 16, 2024, 4:18 p.m.