join_phecode_info: Join data with phecode information

Description Usage Arguments Value See Also Examples

View source: R/join_phecode_info.R

Description

Takes a dataframe with a phecode column in it and desired new phecode information columns to it: description, category, category_number, and phecode_index (the relative position in ordered phenome of phecode).

Usage

1
2
3
4
5
join_phecode_info(
  data_w_phecode,
  phecode_column = phecode,
  cols_to_join = c("description", "category", "category_number", "phecode_index")
)

Arguments

data_w_phecode

Dataframe with a phecode column.

phecode_column

Unquoted column of passed data that contains phecodes

cols_to_join

Which columns of phecode info do you want appended to dataframe?

Value

input dataframe with three columns added to it.

See Also

get_phecode_info

Examples

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

data_w_phecode <- sample_n(phecode_descriptions, 100) %>%
  select(phecode) %>%
  mutate(random = rnorm(n()))

# Default values
data_w_phecode %>%
  join_phecode_info()

# Can change name of phecode column
data_w_phecode %>%
  rename(jd_code = phecode) %>%
  join_phecode_info(jd_code)

# Can choose which columns are added
data_w_phecode %>%
  join_phecode_info(cols_to_join = c("description", "phecode_index"))

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