Learn R Programming

rEHR (version 1.0)

extract_keywords: Function to extract rows from a lookup table based on keywords

Description

This function can be used to build draft clinical code lists based on a clinical or product lookup table and a set of keywords.

Usage

extract_keywords(lookup, keywords, keyword_field = "desc")

Arguments

lookup
a dataframe containing a lookup table
keywords
character vector containing the keyword terms to search for
keyword_field
character identifying the field in the lookup table to be searched for keywords

Value

a data frame subsetted by keyword

Details

See www.clinicalcodes.org for clinical code lists that have been used in previous studies

All keywords are collapsed together in an OR statement

Examples

Run this code
## Not run: 
# keywords <- c('oral ulceration', 'mouth ulceration', 'aphthous ulceration', 
# 'oral aphthous ulceration','oral ulcer[s]?', 'mouth ulcer[s]?', 'aphthous ulcer[s]?', 
# 'aphthous stomatitis', "stomatitis", "aphthae", 'oral aphthous stomatitis', 
# 'oral aphthous ulcers', 'recurrent oral ulcers', 'recurrent mouth ulcers', 
# 'recurrent oral aphthous ulcers', 'recurrent aphthous ulcers', 'recurrent aphthous stomatitis', 
# 'recurrent oral aphthous stomatitis')
# a <- extract_keywords(medical, keywords)
# ## End(Not run)

Run the code above in your browser using DataLab