get_phecode_info: Get phecode information

Description Usage Arguments Value See Also Examples

View source: R/get_phecode_info.R

Description

Either grabs a vector of descriptions for passed vector of phecodes, or vector of categories, or a dataframe with both.

Usage

1
get_phecode_info(codes, what = "description")

Arguments

codes

Vector of phecodes

what

What info should be returned. Options: 'description', 'category', 'all'.

Value

Vector of what is description or category, dataframe with phecode, description, and category if what = 'all'.

See Also

get_phecode_info

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library(dplyr)

# Simulate some random data associated with phecodes
data_w_phecodes <- sample_n(phecode_descriptions, 100) %>%
  select(code = phecode) %>%
  mutate(random = rnorm(n()))

# Use function to add a column with description
data_w_phecodes %>%
  mutate(descrip = get_phecode_info(code, 'description'))

# Use function to add column with category
data_w_phecodes %>%
  mutate(category = get_phecode_info(code, 'category'))

# Use function to get dataframe of category and description that can be to join
# with data
bind_cols(
  data_w_phecodes,
  get_phecode_info(data_w_phecodes$code, 'all')
)

nstrayer/phewasHelper documentation built on April 2, 2020, 5:06 a.m.